Skip to content

Commit 18e823c

Browse files
authored
Merge pull request #14 from contentstack/fix/40809
fix: fixed body parser limit issue
2 parents c546731 + 7061c4f commit 18e823c

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

.github/workflows/sast-scan.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/webhook-listener",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "HTTP web server that listens to Contentstack webhooks. This is part of Contentstack DataSync",
55
"main": "./dist",
66
"types": "./typings",

src/core.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import { createServer } from 'http';
1313
import { promisify } from 'util';
1414
import { logger as log } from './logger';
1515

16-
const jsonParser = promisify(bodyParser.json());
1716

1817
let _config: any = {};
1918
let _notify: any;
2019
const debug = Debug('webhook:listener');
2120

21+
let jsonParser = promisify(bodyParser.json({ limit: '1mb' }));
2222
/**
2323
* Handle requests
2424
* @param {Object} request request object
@@ -88,6 +88,9 @@ const requestHandler = (request, response) => {
8888
}).then(async () => {
8989
debug('parsing json');
9090
try {
91+
if (_config.reqBodyLimit) {
92+
jsonParser = promisify(bodyParser.json({ limit: _config.reqBodyLimit }));
93+
}
9194
await jsonParser(request, response);
9295
const body = request.body;
9396
const type = body.module;

0 commit comments

Comments
 (0)