🐛 Fix bug with Webhook-Process

This commit is contained in:
Jan Oberhauser 2022-02-20 16:44:30 +01:00
parent 3305247984
commit ff20a58c70
3 changed files with 7 additions and 5 deletions

View file

@ -145,6 +145,7 @@ import { TagEntity } from './databases/entities/TagEntity';
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
import { NameRequest } from './WorkflowHelpers';
import { getCredentialTranslationPath, getNodeTranslationPath } from './TranslationHelpers';
import { WEBHOOK_METHODS } from './WebhookHelpers';
require('body-parser-xml')(bodyParser);
@ -240,8 +241,6 @@ class App {
this.presetCredentialsLoaded = false;
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
this.webhookMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
const telemetrySettings: ITelemetrySettings = {
@ -2737,7 +2736,7 @@ class App {
return;
}
if (!this.webhookMethods.includes(method)) {
if (!WEBHOOK_METHODS.includes(method)) {
ResponseHelper.sendErrorResponse(
res,
new Error(`The method ${method} is not supported.`),

View file

@ -56,6 +56,8 @@ import * as ActiveExecutions from './ActiveExecutions';
const activeExecutions = ActiveExecutions.getInstance();
export const WEBHOOK_METHODS = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
/**
* Returns all the webhooks which should be created for the give workflow
*

View file

@ -32,6 +32,7 @@ import {
} from '.';
import * as config from '../config';
import { WEBHOOK_METHODS } from './WebhookHelpers';
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call
require('body-parser-xml')(bodyParser);
@ -70,7 +71,7 @@ export function registerProductionWebhooks() {
return;
}
if (!this.webhookMethods.includes(method)) {
if (!WEBHOOK_METHODS.includes(method)) {
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
return;
}
@ -120,7 +121,7 @@ export function registerProductionWebhooks() {
// if (method === 'OPTIONS') {
// }
if (!this.webhookMethods.includes(method)) {
if (!WEBHOOK_METHODS.includes(method)) {
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
return;
}