How to append custom headers to axios request?
See original GitHub issueI want to add a custom header x-dsi-restful to a get request. But I’m unable to append it through axios. Here is what I did getAppSettings().localRetailVehicleComparablesUrl }/k6MRDHbipIsp4BiKcNm66w/local_retail/comparables`, { method: ‘get’, withCredentials: true, headers: { ‘Content-Type’: ‘application/json; charset=utf-8’, ‘x-dsi-restful’: 1 }
Even though I added it to Header set Access-Control-Allow-Headers “x-dsi-restful, Authorization” I’m unable to append it to the request.
Only if I hardcode the value in apache conf the its working. Like RequestHeader append x-dsi-restful “1”
Is there a way to append it from axios?
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Using Axios to set request headers - LogRocket Blog
Axios methods such as post() and get() enable us to attach headers to requests by supplying a headers' object as the second parameter...
Read more >How to set header and options in axios? - Stack Overflow
There are several ways to do this: For a single request: let config = { headers: { header1: value, } } let data...
Read more >How To Set Request Headers Using Axios? - RapidAPI
If you want to add headers only to specific request types like GET , you can use the defaults.headers.get property. This snippet will...
Read more >How to Send Headers With an Axios POST Request
To send an Axios POST request with headers, you need to use the headers option. With axios.post() , the first parameter is the...
Read more >Axios Cheat Sheet - Kapeli - Dash for macOS
Make a request for a user with a given ID axios.get('/user? ... `headers` are custom headers to be sent headers: {'X-Requested-With': 'XMLHttpRequest'}, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did you guys mean
axios.get('url', {headers: {"x-dsi-restful":1}})
?Hi @ksairamya,
is not working?