fix(Respond to Webhook Node): Disable expressions in Respond With (#14727)

This commit is contained in:
Michael Kret
2025-04-18 11:54:28 +03:00
committed by GitHub
parent 38eaef97fe
commit fec2284a77

View File

@@ -6,6 +6,7 @@ import type {
IN8nHttpFullResponse, IN8nHttpFullResponse,
IN8nHttpResponse, IN8nHttpResponse,
INodeExecutionData, INodeExecutionData,
INodeProperties,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
} from 'n8n-workflow'; } from 'n8n-workflow';
@@ -23,13 +24,63 @@ import type { Readable } from 'stream';
import { formatPrivateKey, generatePairedItemData } from '../../utils/utilities'; import { formatPrivateKey, generatePairedItemData } from '../../utils/utilities';
const respondWithProperty: INodeProperties = {
displayName: 'Respond With',
name: 'respondWith',
type: 'options',
options: [
{
name: 'All Incoming Items',
value: 'allIncomingItems',
description: 'Respond with all input JSON items',
},
{
name: 'Binary File',
value: 'binary',
description: 'Respond with incoming file binary data',
},
{
name: 'First Incoming Item',
value: 'firstIncomingItem',
description: 'Respond with the first input JSON item',
},
{
name: 'JSON',
value: 'json',
description: 'Respond with a custom JSON body',
},
{
name: 'JWT Token',
value: 'jwt',
description: 'Respond with a JWT token',
},
{
name: 'No Data',
value: 'noData',
description: 'Respond with an empty body',
},
{
name: 'Redirect',
value: 'redirect',
description: 'Respond with a redirect to a given URL',
},
{
name: 'Text',
value: 'text',
description: 'Respond with a simple text message body',
},
],
default: 'firstIncomingItem',
description: 'The data that should be returned',
};
export class RespondToWebhook implements INodeType { export class RespondToWebhook implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
displayName: 'Respond to Webhook', displayName: 'Respond to Webhook',
icon: { light: 'file:webhook.svg', dark: 'file:webhook.dark.svg' }, icon: { light: 'file:webhook.svg', dark: 'file:webhook.dark.svg' },
name: 'respondToWebhook', name: 'respondToWebhook',
group: ['transform'], group: ['transform'],
version: [1, 1.1], version: [1, 1.1, 1.2],
description: 'Returns data for Webhook', description: 'Returns data for Webhook',
defaults: { defaults: {
name: 'Respond to Webhook', name: 'Respond to Webhook',
@@ -56,53 +107,13 @@ export class RespondToWebhook implements INodeType {
default: '', default: '',
}, },
{ {
displayName: 'Respond With', ...respondWithProperty,
name: 'respondWith', displayOptions: { show: { '@version': [1, 1.1] } },
type: 'options', },
options: [ {
{ ...respondWithProperty,
name: 'All Incoming Items', noDataExpression: true,
value: 'allIncomingItems', displayOptions: { show: { '@version': [{ _cnd: { gte: 1.2 } }] } },
description: 'Respond with all input JSON items',
},
{
name: 'Binary File',
value: 'binary',
description: 'Respond with incoming file binary data',
},
{
name: 'First Incoming Item',
value: 'firstIncomingItem',
description: 'Respond with the first input JSON item',
},
{
name: 'JSON',
value: 'json',
description: 'Respond with a custom JSON body',
},
{
name: 'JWT Token',
value: 'jwt',
description: 'Respond with a JWT token',
},
{
name: 'No Data',
value: 'noData',
description: 'Respond with an empty body',
},
{
name: 'Redirect',
value: 'redirect',
description: 'Respond with a redirect to a given URL',
},
{
name: 'Text',
value: 'text',
description: 'Respond with a simple text message body',
},
],
default: 'firstIncomingItem',
description: 'The data that should be returned',
}, },
{ {
displayName: 'Credentials', displayName: 'Credentials',