Skip to content

Commit

Permalink
fix(Webhook Node): Fix URL params for webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Aug 22, 2023
1 parent 9e3e298 commit 809da14
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ export class ActiveWorkflowRunner implements IWebhookManager {

Logger.debug(`Received webhook "${httpMethod}" for path "${path}"`);

// Reset request parameters
// @ts-ignore
request.params = {};

// Remove trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1);
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/TestWebhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export class TestWebhooks implements IWebhookManager {
const httpMethod = request.method;
let path = request.params.path;

// Reset request parameters
// @ts-ignore
request.params = {};

// Remove trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1);
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/WaitingWebhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class WaitingWebhooks implements IWebhookManager {
const { path: executionId, suffix } = req.params;
Logger.debug(`Received waiting-webhook "${req.method}" for execution "${executionId}"`);

// Reset request parameters
// @ts-ignore
request.params = {};

const execution = await this.executionRepository.findSingleExecution(executionId, {
includeData: true,
unflattenData: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/nodes-base/nodes/Webhook/Webhook.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class Webhook extends Node {
const response: INodeExecutionData = {
json: {
headers: req.headers,
params: {},
params: req.params,
query: req.query,
body: req.body,
},
Expand Down Expand Up @@ -207,7 +207,7 @@ export class Webhook extends Node {
binary: {},
json: {
headers: req.headers,
params: {},
params: req.params,
query: req.query,
body: data,
},
Expand Down Expand Up @@ -263,7 +263,7 @@ export class Webhook extends Node {
binary: {},
json: {
headers: req.headers,
params: {},
params: req.params,
query: req.query,
body: {},
},
Expand Down

0 comments on commit 809da14

Please sign in to comment.