fix(Respond to Webhook Node): JSON output from expression fix (#7294)

Github issue / Community forum post (link here to close automatically):
https://github.com/n8n-io/n8n/issues/7077
This commit is contained in:
Michael Kret 2023-09-28 16:46:00 +03:00 committed by GitHub
parent 53a7502d20
commit 8bc369dd40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,10 +206,14 @@ export class RespondToWebhook implements INodeType {
if (respondWith === 'json') {
const responseBodyParameter = this.getNodeParameter('responseBody', 0) as string;
if (responseBodyParameter) {
if (typeof responseBodyParameter === 'object') {
responseBody = responseBodyParameter;
} else {
responseBody = jsonParse(responseBodyParameter, {
errorMessage: "Invalid JSON in 'Response Body' field",
});
}
}
} else if (respondWith === 'firstIncomingItem') {
responseBody = items[0].json;
} else if (respondWith === 'text') {