From 86942c4ce78f627b6b5e16a628c147a7a583d687 Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Wed, 6 Oct 2021 19:53:18 +0200 Subject: [PATCH] :bug: Fix "Ignore response code" flag in http request node (#2284) --- packages/core/src/NodeExecuteFunctions.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 6786c10ea5..189a2a7dac 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -303,7 +303,7 @@ async function parseRequestObject(requestObject: IDataObject) { axiosConfig.maxRedirects = 0; } if ( - requestObject.followAllRedirect === false && + requestObject.followAllRedirects === false && ((requestObject.method as string | undefined) || 'get').toLowerCase() !== 'get' ) { axiosConfig.maxRedirects = 0; @@ -420,6 +420,16 @@ 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; + } + Logger.debug('Request proxied to Axios failed', { error }); // Axios hydrates the original error with more data. We extract them. // https://github.com/axios/axios/blob/master/lib/core/enhanceError.js