mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(HTTP Request Node): Bug - node requires string instead of json
This commit is contained in:
@@ -1109,19 +1109,23 @@ export class HttpRequestV3 implements INodeType {
|
|||||||
);
|
);
|
||||||
} else if (specifyBody === 'json') {
|
} else if (specifyBody === 'json') {
|
||||||
// body is specified using JSON
|
// body is specified using JSON
|
||||||
try {
|
if (typeof jsonBodyParameter !== 'object' && jsonBodyParameter !== null) {
|
||||||
JSON.parse(jsonBodyParameter);
|
try {
|
||||||
} catch (_) {
|
JSON.parse(jsonBodyParameter);
|
||||||
throw new NodeOperationError(
|
} catch (_) {
|
||||||
this.getNode(),
|
throw new NodeOperationError(
|
||||||
'JSON parameter need to be an valid JSON',
|
this.getNode(),
|
||||||
{
|
'JSON parameter need to be an valid JSON',
|
||||||
runIndex: itemIndex,
|
{
|
||||||
},
|
runIndex: itemIndex,
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|||||||
Reference in New Issue
Block a user