Axios Instance 400 returned as Success #5875
Replies: 4 comments
-
The error is in your interceptor. Failed requests should return a rejected promise return Promise.reject(error); See the docs ~ https://github.com/axios/axios#interceptors |
Beta Was this translation helpful? Give feedback.
-
I think that is more related to the default value of the |
Beta Was this translation helpful? Give feedback.
-
Same problem. The issue seems to be with the Axios treating 400s differently in the interceptor. I try adding this but it still treats 400s in then and not in catches.
Maybe I am missing something. |
Beta Was this translation helpful? Give feedback.
-
I am doing it in a hacky way. In the success interceptor function, I throw an error
|
Beta Was this translation helpful? Give feedback.
-
Describe the bug
when i use an axios instance i created , the 400 status code is returned in .then() as success but when i use the default axios it return as an error in the .catch() , i don't know why this is happening , i tried adding the validateStatus : () => return false and it keeps returning everything as success .
To Reproduce
i imported the axiosToken on project initialization and injected my token and made an interceptor for the 401 error status code
Code snippet
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
Beta Was this translation helpful? Give feedback.
All reactions