mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Parse any readable stream response instead of only IncomingMessage (#8359)
This commit is contained in:
parent
159b328587
commit
eb1320fd7a
|
@ -2855,10 +2855,7 @@ const getRequestHelperFunctions = (
|
||||||
|
|
||||||
let contentBody: Exclude<IN8nHttpResponse, Buffer>;
|
let contentBody: Exclude<IN8nHttpResponse, Buffer>;
|
||||||
|
|
||||||
if (
|
if (newResponse.body instanceof Readable && paginationOptions.binaryResult !== true) {
|
||||||
newResponse.body?.constructor.name === 'IncomingMessage' &&
|
|
||||||
paginationOptions.binaryResult !== true
|
|
||||||
) {
|
|
||||||
const data = await this.helpers
|
const data = await this.helpers
|
||||||
.binaryToBuffer(newResponse.body as Buffer | Readable)
|
.binaryToBuffer(newResponse.body as Buffer | Readable)
|
||||||
.then((body) => body.toString());
|
.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
|
// 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.
|
// now an error manually if the response code is not a success one.
|
||||||
let data = tempResponseData.body;
|
let data = tempResponseData.body;
|
||||||
if (
|
if (data instanceof Readable && paginationOptions.binaryResult !== true) {
|
||||||
data?.constructor.name === 'IncomingMessage' &&
|
|
||||||
paginationOptions.binaryResult !== true
|
|
||||||
) {
|
|
||||||
data = await this.helpers
|
data = await this.helpers
|
||||||
.binaryToBuffer(tempResponseData.body as Buffer | Readable)
|
.binaryToBuffer(tempResponseData.body as Buffer | Readable)
|
||||||
.then((body) => body.toString());
|
.then((body) => body.toString());
|
||||||
|
|
Loading…
Reference in a new issue