fix(HTTP Request Node): Respect the original encoding of the incoming response (#9869)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-07-11 17:03:52 +02:00
committed by GitHub
parent e84ab35c4a
commit 2d19aef540
9 changed files with 152 additions and 41 deletions

View File

@@ -1945,9 +1945,7 @@ export class HttpRequestV3 implements INodeType {
false,
) as boolean;
const data = await this.helpers
.binaryToBuffer(response.body as Buffer | Readable)
.then((body) => body.toString());
const data = await this.helpers.binaryToString(response.body as Buffer | Readable);
response.body = jsonParse(data, {
...(neverError
? { fallbackValue: {} }
@@ -1959,9 +1957,7 @@ export class HttpRequestV3 implements INodeType {
} else {
responseFormat = 'text';
if (!response.__bodyResolved) {
const data = await this.helpers
.binaryToBuffer(response.body as Buffer | Readable)
.then((body) => body.toString());
const data = await this.helpers.binaryToString(response.body as Buffer | Readable);
response.body = !data ? undefined : data;
}
}