question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default Authorization header no longer working in 0.19.0

See original GitHub issue

Describe the bug Since axios 0.19.0, the default Authorization header is no longer set in query. It works in 0.18.X.

To Reproduce Create an axios adapter and set to it a default Authorization header, nothing is sent in the query.

axios.defaults.headers.common.Authorization = 'Bearer ANY SECURITY TOKEN';

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
glebtvcommented, Jun 3, 2019

axios global defaults (axios.defaults.headers) seem to no longer affect prevoiusly-created axios client instances. Is this an intended change?

Example: 0.18 - header is sent https://codesandbox.io/s/axios018-8fg9d 0.19 - header is not sent https://codesandbox.io/s/axios019-5ddn8

4reactions
jasonsaaymancommented, Jun 3, 2019

@glebtv this seems to in fact be intended. The documentation might need a bit of adjustment for this, I will have a look at it, however, it seems you may need to implement this:

instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;

This will change the instance defaults rather than the global default. This makes sense, especially in this example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to add Axios Default Headers to VueJS app
Since version 0.19 axios no longer uses axios.defaults if you create axios instances to make requests. Set defaults to an instance and use ......
Read more >
History — Nipyapi 0.19.0 documentation - Read the Docs
Added gzip as default request header (PR from rsaggino). Update ruamel.yaml to 0.17.16. Update file read/write to explicitly handle encoding, default to ...
Read more >
axios cookie header | The AI Search Engine You Control
Not Receiving Set-Cookie Header with axios post request ... getState().session.token; if (token) { axios.defaults.headers.common['Authorization'] = token; } ...
Read more >
WWW-Authenticate - HTTP - MDN Web Docs
This new request uses the Authorization header to supply the credentials to the server, encoded appropriately for the selected "challenge" ...
Read more >
httpx · PyPI
HTTPX is a fully featured HTTP client library for Python 3. ... does not auto-generate any headers on the request instance. (Pull #1607) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found