Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable limit on JSON payload size #1303

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/robot.coffee
Expand Up @@ -416,6 +416,8 @@ class Robot
port = process.env.EXPRESS_PORT or process.env.PORT or 8080
address = process.env.EXPRESS_BIND_ADDRESS or process.env.BIND_ADDRESS or '0.0.0.0'

expressRequestJsonSize = process.env.EXPRESS_REQUEST_JSON_SIZE or '1mb'

express = require 'express'
multipart = require 'connect-multiparty'

Expand All @@ -428,8 +430,9 @@ class Robot
app.use express.basicAuth user, pass if user and pass
app.use express.query()

app.use express.json()
app.use express.json({limit: expressRequestJsonSize})
app.use express.urlencoded()

# replacement for deprecated express.multipart/connect.multipart
# limit to 100mb, as per the old behavior
app.use multipart(maxFilesSize: 100 * 1024 * 1024)
Expand Down