fix(HTTP Request Node): Bug - node requires string instead of json

This commit is contained in:
Michael Kret 2023-01-19 11:34:36 +02:00 committed by GitHub
parent e275306c64
commit 8f49f494ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1109,6 +1109,7 @@ export class HttpRequestV3 implements INodeType {
); );
} else if (specifyBody === 'json') { } else if (specifyBody === 'json') {
// body is specified using JSON // body is specified using JSON
if (typeof jsonBodyParameter !== 'object' && jsonBodyParameter !== null) {
try { try {
JSON.parse(jsonBodyParameter); JSON.parse(jsonBodyParameter);
} catch (_) { } catch (_) {
@ -1122,6 +1123,9 @@ export class HttpRequestV3 implements INodeType {
} }
requestOptions.body = jsonParse(jsonBodyParameter); requestOptions.body = jsonParse(jsonBodyParameter);
} else {
requestOptions.body = jsonBodyParameter;
}
} else if (specifyBody === 'string') { } else if (specifyBody === 'string') {
//form urlencoded //form urlencoded
requestOptions.body = Object.fromEntries(new URLSearchParams(body)); requestOptions.body = Object.fromEntries(new URLSearchParams(body));