Skip to content

Commit b3b59ba

Browse files
ottomatad00rman
authored andcommitted
Allow configuration of bodyParser limit via app.conf.max_body_size
Bug: T226026
1 parent 6d195e3 commit b3b59ba

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function initApp(options) {
124124
// enable compression
125125
app.use(compression({ level: app.conf.compression_level }));
126126
// use the JSON body parser
127-
app.use(bodyParser.json());
127+
app.use(bodyParser.json({ limit: app.conf.max_body_size || '100kb' }));
128128
// use the application/x-www-form-urlencoded parser
129129
app.use(bodyParser.urlencoded({ extended: true }));
130130

config.dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ services:
6262
# the user agent to use when issuing requests
6363
# user_agent: service-template-node
6464
# the template used for contacting the MW API
65+
#
66+
# # Max JSON POST body size limit.
67+
# max_body_size: 100kb
6568
mwapi_req:
6669
method: post
6770
uri: https://{{domain}}/w/api.php

config.prod.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ services:
6262
# the user agent to use when issuing requests
6363
# user_agent: service-template-node
6464
# the template used for contacting the MW API
65+
#
66+
# Max JSON POST body size limit.
67+
# max_body_size: 100kb
6568
mwapi_req:
6669
method: post
6770
uri: http://api.svc.eqiad.wmnet/w/api.php

0 commit comments

Comments
 (0)