mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Webhook Node): Setting to enable multiple outputs/methods (#9086)
Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
@@ -74,7 +74,60 @@ export class Webhook extends Node {
|
||||
credentials: credentialsProperty(this.authPropertyName),
|
||||
webhooks: [defaultWebhookDescription],
|
||||
properties: [
|
||||
httpMethodsProperty,
|
||||
{
|
||||
displayName: 'Allow Multiple HTTP Methods',
|
||||
name: 'multipleMethods',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
isNodeSetting: true,
|
||||
description: 'Whether to allow the webhook to listen for multiple HTTP methods',
|
||||
},
|
||||
{
|
||||
...httpMethodsProperty,
|
||||
displayOptions: {
|
||||
show: {
|
||||
multipleMethods: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'HTTP Methods',
|
||||
name: 'httpMethod',
|
||||
type: 'multiOptions',
|
||||
options: [
|
||||
{
|
||||
name: 'DELETE',
|
||||
value: 'DELETE',
|
||||
},
|
||||
{
|
||||
name: 'GET',
|
||||
value: 'GET',
|
||||
},
|
||||
{
|
||||
name: 'HEAD',
|
||||
value: 'HEAD',
|
||||
},
|
||||
{
|
||||
name: 'PATCH',
|
||||
value: 'PATCH',
|
||||
},
|
||||
{
|
||||
name: 'POST',
|
||||
value: 'POST',
|
||||
},
|
||||
{
|
||||
name: 'PUT',
|
||||
value: 'PUT',
|
||||
},
|
||||
],
|
||||
default: ['GET', 'POST'],
|
||||
description: 'The HTTP methods to listen to',
|
||||
displayOptions: {
|
||||
show: {
|
||||
multipleMethods: [true],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Path',
|
||||
name: 'path',
|
||||
@@ -144,6 +197,7 @@ export class Webhook extends Node {
|
||||
};
|
||||
const req = context.getRequestObject();
|
||||
const resp = context.getResponseObject();
|
||||
const requestMethod = context.getRequestObject().method;
|
||||
|
||||
if (!isIpWhitelisted(options.ipWhitelist, req.ips, req.ip)) {
|
||||
resp.writeHead(403);
|
||||
@@ -165,7 +219,7 @@ export class Webhook extends Node {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const prepareOutput = setupOutputConnection(context, {
|
||||
const prepareOutput = setupOutputConnection(context, requestMethod, {
|
||||
jwtPayload: validationData,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user