Merge pull request #4775 from lohxt1/axios_instance_redirect_error_fix

fix: return the actual axios error in bruno-cli' axios-instance for url-redirect related errors
This commit is contained in:
lohit
2025-05-27 20:27:48 +05:30
committed by GitHub

View File

@@ -92,14 +92,14 @@ function makeAxiosInstance({ requestMaxRedirects = 5, disableCookies } = {}) {
if (redirectResponseCodes.includes(error.response.status)) {
if (redirectCount >= requestMaxRedirects) {
const err = new Error(`Maximum redirects (${requestMaxRedirects}) exceeded`);
err.originalError = error;
return Promise.reject(err);
// todo: needs to be discussed whether the original error response message should be modified or not
return Promise.reject(error);
}
const locationHeader = error.response.headers.location;
if (!locationHeader) {
return Promise.reject(new Error('Redirect location header missing'));
// todo: needs to be discussed whether the original error response message should be modified or not
return Promise.reject(error);
}
redirectCount++;