Fixed ignore response code flag to work properly with return full response (#2370)

This commit is contained in:
Omar Ajoue 2021-10-27 01:58:08 +02:00 committed by GitHub
parent db738fc824
commit 15d05c7f01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -438,17 +438,17 @@ async function proxyRequestToAxios(
}
})
.catch((error) => {
if (configObject.simple === true && error.response) {
resolve({
body: error.response.data,
headers: error.response.headers,
statusCode: error.response.status,
statusMessage: error.response.statusText,
});
return;
}
if (configObject.simple === false && error.response) {
resolve(error.response.data);
if (configObject.resolveWithFullResponse) {
resolve({
body: error.response.data,
headers: error.response.headers,
statusCode: error.response.status,
statusMessage: error.response.statusText,
});
} else {
resolve(error.response.data);
}
return;
}