Passing custom props via axios config
See original GitHub issueDescribe the bug
We use some custom parameters via axios configuration. They are used in the response interceptor. Sometimes there may be a lot of information there, so the option to pass it through the headers
or params
is not suitable for us because of the length limit
To Reproduce
- Open: https://jsfiddle.net/w2rmhy4c/1/
- Attach axios 0.18 (uncomment line with
axios@0.18.0
) - Run fiddle (console show true)
- Attach axios 0.19 (uncomment line with
axios@0.19.0
) - Run fiddle (console show undefined)
Expected behavior Custom config parameter passed. Or the ability to use another config option to pass custom data.
Environment:
- Axios Version 0.18/0.19
Additional context/Screenshots First messages with axios 0.18, second with 0.19
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:35
Top Results From Across the Web
How to add a custom property to axios config? - Stack Overflow
You can check the pull request Fixing custom config options. I have tried the latest version(0.21.1) of axios, the custom config works fine....
Read more >Request Config | Axios Docs
Request Config. These are the available config options for making requests. Only the url is required. Requests will default to GET if method...
Read more >Complete Guide to Axios HTTP Client - Reflectoring
An Axios instance created with Axios.create() with a custom config helps us to reuse the provided configuration for all the API invocations made ......
Read more >How to make HTTP requests with Axios - LogRocket Blog
Making an HTTP request is as easy as passing a config object to the Axios function. You can make a POST request using...
Read more >axios - npm
Start using axios in your project by running `npm i axios`. ... axios API. Requests can be made by passing the relevant config...
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
need this too
I need this too. I had this working in 0.18 but it stopped working in 0.19
I used something like this:
but it no longer shows up in the interceptor config:
Edit: just confirmed this works in 0.18.1 so I’m reverting back for now