New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get the third parameter in the interceptor? #2216
Comments
Third parameters used to be merged into config object. Could you please restore v0.18 behavior ? Thanks ! |
We've got the same problems we are using it for a custom error handler but since the update tot 0.19.x its not working anymore. @axios can you please fix this feature? |
Same issue here. Before this version (v0.19) was possible to add custom parameters to the config object. Any updates on this? |
The same here! Hope custom parameters could be supported as it used to be. |
In v0.19 , it add a 'mergeConfig' function in /lib/axios.js. It will only allow some standard keywords to the config , maybe for "Consistent coding style" |
Same issue here. In v0.18 I would pass in "custom" configuration that would then be intercepted in a request interceptor to apply the correct headers. We are doing this as we migrate major versions of our back end. Here is an example of the request: const response = await Vue.axios.get(`${_baseUrl}/${companyId}/employees`, { acceptVersion: '1.0.0', adminVersion: 2 } )
return response.data.employees Then in our request interceptor we have the following code: axios.interceptors.request.use( config => {
config.headers = Object.assign(config.headers || {}, {
'X-Admin-Version': config.adminVersion || 1, // Temporary Default, this should be 2
'Accept-Version': config.acceptVersion || '2.0.0' // Temporary Default, this should be 2.0.0
})
config.withCredentials = true
return config
}) Once we upgraded to v0.19 the config options for From what I can tell, the merging of the config was the culprit in line 37 of the Are there plans to restore the functionality or should we be planning going a different route? If you don't plan on restoring the functionality, is there a way to get another hook in place that will let me modify the config before you run the merge? Thanks in advance. |
#2207 will fix this once it is merged. |
If a third parameter is sent when a post request is requested, the parameter sent in the 'config' factor of 'request interceptor' cannot be found.
ex)
axios.post('url', {parameter}, {options})
...
axios.interceptors.request.use(config => {
config.options // not found
})
It was possible at 0.18.x, but not at 0.19.x. How can I get a third parameter from the interceptor?
The text was updated successfully, but these errors were encountered: