🐛 Fix "Ignore response code" flag in http request node (#2284)

This commit is contained in:
Omar Ajoue 2021-10-06 19:53:18 +02:00 committed by GitHub
parent e2daa523d4
commit 86942c4ce7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -303,7 +303,7 @@ async function parseRequestObject(requestObject: IDataObject) {
axiosConfig.maxRedirects = 0; axiosConfig.maxRedirects = 0;
} }
if ( if (
requestObject.followAllRedirect === false && requestObject.followAllRedirects === false &&
((requestObject.method as string | undefined) || 'get').toLowerCase() !== 'get' ((requestObject.method as string | undefined) || 'get').toLowerCase() !== 'get'
) { ) {
axiosConfig.maxRedirects = 0; axiosConfig.maxRedirects = 0;
@ -420,6 +420,16 @@ async function proxyRequestToAxios(
} }
}) })
.catch((error) => { .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;
}
Logger.debug('Request proxied to Axios failed', { error }); Logger.debug('Request proxied to Axios failed', { error });
// Axios hydrates the original error with more data. We extract them. // Axios hydrates the original error with more data. We extract them.
// https://github.com/axios/axios/blob/master/lib/core/enhanceError.js // https://github.com/axios/axios/blob/master/lib/core/enhanceError.js