Default headers for authorization not working on 0.19.0
See original GitHub issueI’m using several axios instances to send requests to different endpoints but I’m setting an access token authorization header in axios defaults like this:
axios.defaults.headers['Authorization'] = 'Bearer ' + myToken
In version 0.18.1 everything works fine and the token is sent on every request. After update to version 0.19.0 it stopped working.
I read in the documentation that I should set default headers like this: axios.defaults.headers.common['Authorization'] = 'Bearer ' + myToken
, but it doesn’t work. No authorization header is sent.
I even throw a console.log(axios.defaults.headers.common['Authorization'])
before one of my requests and the token is there in axios defaults, but it seems to ignore it.
Couldn’t find anything in documentation telling if something changed from the previous version. So either it’s a bug or I’m doing something wrong. I would like you to clarify me.
Thanks in advance.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:12
Top GitHub Comments
hmm weird, a few more people are reporting bugs with
0.19
, most likely this will need investigation, thanks for the heads upSeeing issues as well. When trying to add
Authorization
header to axios Get request it appears the header never actually gets attached. Had to switch back to thefetch
api for now.