-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
After successfully cancelling Axios, will the 'then' callback still execute? #6272
Comments
https://axios-http.com/zh/docs/cancellation now use signal: controller.signal. cancelToken is old ! |
Thank you for your response. I will proceed with the latest approach, but I am still curious about the answer to my previous question: will the 'then' be executed? @startjava |
Successfully cancelled Axios, but why did the 'then' continue to execute? Here is the code: axios.get('/foo/bar', { |
check response param about propperties |
No, it won't. Cancellation in Axios, as in fetch, means promise rejection with a special error instance, so only the callback of the catch chain will be invoked. |
Describe the issue
The following is my code. After successfully canceling Axios, will the log (test then) in 'then' still be printed to the console? In other words, will 'then' still execute?
AXIOS.post(
test`, data,{cancelToken: cancelSource.cancelToken,
}).then(response => {
console.log("test then")
}).catch(error => {
})`
Example Code
No response
Expected behavior
No response
Axios Version
No response
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: