config.data has been changed in response interceptor
See original GitHub issueI am using axios request and response interceptors but it seems response.config.data
is not an Object.
Here is my Request interceptor:
config.data
is an instance of my Form Object
API.interceptors.request.use((config) => {
if (config.data instanceof Form) {
config.data.startProcessing()
}
return config
})
Now going to the response interceptor, it seems it is not a Form anymore when it is a string already.
API.interceptors.response.use((response) => {
// this response.config.data is now a string not my Form object anymore
if (response.config.data instanceof Form) {
response.config.data.finishProcessing()
}
return response
})
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Error using axios interceptors and responses - Stack Overflow
I want to intercept requests and responses and add the user's token. When I try to use the request interceptor, I get the...
Read more >config | API Reference | ArcGIS Maps SDK for JavaScript 4.25
Makes changes to the response after the request is sent, but before it's returned to the caller. Parameter. response RequestResponse. The response object....
Read more >Intercepting Requests & Responses Using Axios
The steps to create Axios request & response interceptors are: Create a new Axios instance with a custom config; Create request, response & ......
Read more >10 Using Service Interceptors to Manipulate Requests
When the request returns from the application, the data can be changed as the request returns through the invocation chain. This is useful...
Read more >Making HTTP requests with Axios - CircleCI
Axios is a promise-based HTTP library that lets developers make ... should display a response after the Axios request has been made and...
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
so just try this in node-module/axios/lib/defaults.js,change this Fun.
hope this can help you.
The reason is that config.data has been changed in response interceptor, as well as my edited issue title. A workaround can be saving the original data in a customized field of the config.