302 error how to capture the status code? axios, can't get the error report.

Error: Network Error

at createError (eval at <anonymous> (bundle.js:1759), <anonymous>:16:15)
at XMLHttpRequest.handleError (eval at <anonymous> (bundle.js:1741), <anonymous>:87:14)

print err in interceptor is the above, without getting err.response.status

Mar.25,2021

this is not a problem with axios. XMLHttpRequest itself automatically forwards the redirect request, so you can't get it.

take a look at my test results
clipboard.png

Network
clipboard.png

therefore, the error you currently return is also the result of the final directed url.

Menu