Skip to content

Commit e7dd78e

Browse files
authored
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
2 parents 8e23a70 + 9ad0f2d commit e7dd78e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/bruno-cli/src/utils/axios-instance.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ function makeAxiosInstance({ requestMaxRedirects = 5, disableCookies } = {}) {
9292

9393
if (redirectResponseCodes.includes(error.response.status)) {
9494
if (redirectCount >= requestMaxRedirects) {
95-
const err = new Error(`Maximum redirects (${requestMaxRedirects}) exceeded`);
96-
err.originalError = error;
97-
return Promise.reject(err);
95+
// todo: needs to be discussed whether the original error response message should be modified or not
96+
return Promise.reject(error);
9897
}
9998

10099
const locationHeader = error.response.headers.location;
101100
if (!locationHeader) {
102-
return Promise.reject(new Error('Redirect location header missing'));
101+
// todo: needs to be discussed whether the original error response message should be modified or not
102+
return Promise.reject(error);
103103
}
104104

105105
redirectCount++;

0 commit comments

Comments
 (0)