fix(core): Restore body parsing for all content-types for non webhook routes (no-changelog)(#6911)

Changes in https://github.com/n8n-io/n8n/pull/6394 removed xml body parsing for all non-webhook routes. This broken SAML endpoints as they need the XML body parser to function correctly.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-08-11 09:18:33 +02:00
committed by GitHub
parent 78c83168ac
commit 10c15874b2
4 changed files with 43 additions and 52 deletions

View File

@@ -11,7 +11,7 @@ import { N8nInstanceType } from '@/Interfaces';
import type { IExternalHooksClass } from '@/Interfaces';
import { ExternalHooks } from '@/ExternalHooks';
import { send, sendErrorResponse, ServiceUnavailableError } from '@/ResponseHelper';
import { rawBody, jsonParser, corsMiddleware } from '@/middlewares';
import { rawBodyReader, bodyParser, corsMiddleware } from '@/middlewares';
import { TestWebhooks } from '@/TestWebhooks';
import { WaitingWebhooks } from '@/WaitingWebhooks';
import { webhookRequestHandler } from '@/WebhookHelpers';
@@ -98,7 +98,7 @@ export abstract class AbstractServer {
this.app.use(compression());
// Read incoming data into `rawBody`
this.app.use(rawBody);
this.app.use(rawBodyReader);
}
private setupDevMiddlewares() {
@@ -274,8 +274,8 @@ export abstract class AbstractServer {
this.setupDevMiddlewares();
}
// Setup JSON parsing middleware after the webhook handlers are setup
this.app.use(jsonParser);
// Setup body parsing middleware after the webhook handlers are setup
this.app.use(bodyParser);
await this.configure();