mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(core): Better error message in Webhook node when using the POST method
This commit is contained in:
@@ -18,6 +18,7 @@ import type { IResponseCallbackData, IWorkflowDb } from '@/Interfaces';
|
||||
import { Push } from '@/push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import { webhookNotFoundErrorMessage } from './utils';
|
||||
|
||||
const WEBHOOK_TEST_UNREGISTERED_HINT =
|
||||
"Click the 'Execute workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)";
|
||||
@@ -69,8 +70,9 @@ export class TestWebhooks {
|
||||
webhookData = activeWebhooks.get(httpMethod, pathElements.join('/'), webhookId);
|
||||
if (webhookData === undefined) {
|
||||
// The requested webhook is not registered
|
||||
const methods = await this.getWebhookMethods(path);
|
||||
throw new ResponseHelper.NotFoundError(
|
||||
`The requested webhook "${httpMethod} ${path}" is not registered.`,
|
||||
webhookNotFoundErrorMessage(path, httpMethod, methods),
|
||||
WEBHOOK_TEST_UNREGISTERED_HINT,
|
||||
);
|
||||
}
|
||||
@@ -95,8 +97,9 @@ export class TestWebhooks {
|
||||
// TODO: Clean that duplication up one day and improve code generally
|
||||
if (testWebhookData[webhookKey] === undefined) {
|
||||
// The requested webhook is not registered
|
||||
const methods = await this.getWebhookMethods(path);
|
||||
throw new ResponseHelper.NotFoundError(
|
||||
`The requested webhook "${httpMethod} ${path}" is not registered.`,
|
||||
webhookNotFoundErrorMessage(path, httpMethod, methods),
|
||||
WEBHOOK_TEST_UNREGISTERED_HINT,
|
||||
);
|
||||
}
|
||||
@@ -160,7 +163,7 @@ export class TestWebhooks {
|
||||
if (!webhookMethods.length) {
|
||||
// The requested webhook is not registered
|
||||
throw new ResponseHelper.NotFoundError(
|
||||
`The requested webhook "${path}" is not registered.`,
|
||||
webhookNotFoundErrorMessage(path),
|
||||
WEBHOOK_TEST_UNREGISTERED_HINT,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user