You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using transformRequest to add custom header to the request before it is sent the following way:
const apiClient = redaxios.create({
baseURL,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json; charset=utf-8',
},
transformRequest: [(data, headers) => {
console.log(headers['Payload-Signature']); // <-- here I see header set for previous request
if (data) headers['Payload-Signature'] = signRequestBody(data);
}],
});
As show in code above headers object is shared between requests and because of that it is not possible to customise headers per requests before one is sent.
The reason is that internal deepMerge function doesn't create a copy of 'options.header' property.
Expected behaviour:
I would expect it is possible to safely transform headers per request or modify other request props.
I'm using transformRequest to add custom header to the request before it is sent the following way:
As show in code above headers object is shared between requests and because of that it is not possible to customise headers per requests before one is sent.
The reason is that internal deepMerge function doesn't create a copy of 'options.header' property.
Expected behaviour:
I would expect it is possible to safely transform headers per request or modify other request props.
As a workaround I define a custom fetch:
The text was updated successfully, but these errors were encountered: