From a9a5de57bb32e7552fac2ccdf5a378efe8d808fe Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Wed, 17 Jan 2024 11:13:06 +0100 Subject: [PATCH] Parse any readable stream response instead of only IncomingMessage --- packages/core/src/NodeExecuteFunctions.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 746d30eedee84..73a9621248501 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -2855,10 +2855,7 @@ const getRequestHelperFunctions = ( let contentBody: Exclude; - if ( - newResponse.body?.constructor.name === 'IncomingMessage' && - paginationOptions.binaryResult !== true - ) { + if (newResponse.body instanceof Readable && paginationOptions.binaryResult !== true) { const data = await this.helpers .binaryToBuffer(newResponse.body as Buffer | Readable) .then((body) => body.toString()); @@ -2954,10 +2951,7 @@ const getRequestHelperFunctions = ( // configured to stop on 404 response codes. For that reason we have to throw here // now an error manually if the response code is not a success one. let data = tempResponseData.body; - if ( - data?.constructor.name === 'IncomingMessage' && - paginationOptions.binaryResult !== true - ) { + if (data instanceof Readable && paginationOptions.binaryResult !== true) { data = await this.helpers .binaryToBuffer(tempResponseData.body as Buffer | Readable) .then((body) => body.toString());