Does Axios have the ability to detect redirects?

Compare the request URL from your code with the URL given by response.request.responseURL; if those aren’t equal, you know the request was redirected.

As far as the status code being 200, that’s what’s required by the spec; no intermediate status codes are exposed to frontend JavaScript running in a browser — regardless of which API you use. See also the answer at http://stackoverflow.com/a/46031800/441757


You can get the redirect count:

const response = await axios.get('http://someurlthatredirects.com');
console.log(response.request._redirectable._redirectCount);