AxiosHeaders {
authorization: 'Basic example',
[Symbol(defaults)]: { Accept: 'application/json, text/plain, */*' }
}
AxiosHeaders {
'[object Object]': undefined,
[Symbol(defaults)]: { '0': [Function: get] }
}
node:internal/errors:477
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["0"]
at ClientRequest.setHeader (node:_http_outgoing:606:3)
at new ClientRequest (node:_http_client:275:14)
at Object.request (node:http:96:10)
at RedirectableRequest._performRequest (/Users/maxharlow/Desktop/node_modules/follow-redirects/index.js:284:24)
at new RedirectableRequest (/Users/maxharlow/Desktop/node_modules/follow-redirects/index.js:66:8)
at Object.request (/Users/maxharlow/Desktop/node_modules/follow-redirects/index.js:523:14)
at dispatchHttpRequest (file:///Users/maxharlow/Desktop/node_modules/axios/lib/adapters/http.js:371:21)
at new Promise (<anonymous>)
at httpAdapter (file:///Users/maxharlow/Desktop/node_modules/axios/lib/adapters/http.js:105:10)
at Axios.dispatchRequest (file:///Users/maxharlow/Desktop/node_modules/axios/lib/core/dispatchRequest.js:46:10) {
code: 'ERR_INVALID_CHAR'
}
So you can see the authorisation header has been lost on the retried request, replaced with '[object Object]': undefined.
Retried requests seem to lose the configured headers. For example this:
Produces this output:
So you can see the authorisation header has been lost on the retried request, replaced with
'[object Object]': undefined
.I'm using Axios v1.1.3 and Axios Retry v3.3.1.