feat: request increase body size limit to 1mb
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import createError from 'http-errors';
|
import createError from 'http-errors';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import appConfig from './config/app';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import corsOptions from './config/cors-options';
|
import corsOptions from './config/cors-options';
|
||||||
import morgan from './helpers/morgan';
|
import morgan from './helpers/morgan';
|
||||||
@@ -26,6 +27,7 @@ appAssetsHandler(app);
|
|||||||
app.use(morgan);
|
app.use(morgan);
|
||||||
app.use(
|
app.use(
|
||||||
express.json({
|
express.json({
|
||||||
|
limit: appConfig.requestBodySizeLimit,
|
||||||
verify(req, res, buf) {
|
verify(req, res, buf) {
|
||||||
(req as IRequest).rawBody = buf;
|
(req as IRequest).rawBody = buf;
|
||||||
},
|
},
|
||||||
@@ -33,6 +35,7 @@ app.use(
|
|||||||
);
|
);
|
||||||
app.use(express.urlencoded({
|
app.use(express.urlencoded({
|
||||||
extended: false,
|
extended: false,
|
||||||
|
limit: appConfig.requestBodySizeLimit,
|
||||||
verify(req, res, buf) {
|
verify(req, res, buf) {
|
||||||
(req as IRequest).rawBody = buf;
|
(req as IRequest).rawBody = buf;
|
||||||
},
|
},
|
||||||
|
@@ -31,6 +31,7 @@ type AppConfig = {
|
|||||||
bullMQDashboardUsername: string;
|
bullMQDashboardUsername: string;
|
||||||
bullMQDashboardPassword: string;
|
bullMQDashboardPassword: string;
|
||||||
telemetryEnabled: boolean;
|
telemetryEnabled: boolean;
|
||||||
|
requestBodySizeLimit: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const host = process.env.HOST || 'localhost';
|
const host = process.env.HOST || 'localhost';
|
||||||
@@ -89,6 +90,7 @@ const appConfig: AppConfig = {
|
|||||||
webAppUrl,
|
webAppUrl,
|
||||||
webhookUrl,
|
webhookUrl,
|
||||||
telemetryEnabled: process.env.TELEMETRY_ENABLED === 'false' ? false : true,
|
telemetryEnabled: process.env.TELEMETRY_ENABLED === 'false' ? false : true,
|
||||||
|
requestBodySizeLimit: '1mb',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!appConfig.encryptionKey) {
|
if (!appConfig.encryptionKey) {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import express, { Router } from 'express';
|
import express, { Router } from 'express';
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
import { IRequest } from '@automatisch/types';
|
import { IRequest } from '@automatisch/types';
|
||||||
|
import appConfig from '../config/app';
|
||||||
import webhookHandler from '../controllers/webhooks/handler';
|
import webhookHandler from '../controllers/webhooks/handler';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
@@ -9,6 +10,7 @@ const upload = multer();
|
|||||||
router.use(upload.none());
|
router.use(upload.none());
|
||||||
|
|
||||||
router.use(express.text({
|
router.use(express.text({
|
||||||
|
limit: appConfig.requestBodySizeLimit,
|
||||||
verify(req, res, buf) {
|
verify(req, res, buf) {
|
||||||
(req as IRequest).rawBody = buf;
|
(req as IRequest).rawBody = buf;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user