Skip to content

Commit

Permalink
Rename flag cds.server.max_request_body_size -> `cds.server.body_pa…
Browse files Browse the repository at this point in the history
…rser.limit`
  • Loading branch information
schwma committed Jul 26, 2024
1 parent 553685a commit b82e7ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Support for configuring request payload limit using global flag `cds.server.max_request_body_size`
- Support for configuring request payload limit using global flag `cds.server.body_parser.limit`

### Changed

Expand Down
6 changes: 1 addition & 5 deletions lib/GraphQLAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ function GraphQLAdapter(options) {
? require(path.join(cds.root, options.errorFormatter))
: defaultErrorFormatter

const bodyParserOptions = {}
const { max_request_body_size } = cds.env.server
if (max_request_body_size) bodyParserOptions.limit = max_request_body_size

router
.use(express.json(bodyParserOptions)) //> required by logger below
.use(express.json({ ...cds.env.server.body_parser })) //> required by logger below
.use(queryLogger)

if (options.graphiql) router.use(graphiql)
Expand Down
4 changes: 3 additions & 1 deletion test/resources/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
},
"cds": {
"server": {
"max_request_body_size": "110KB"
"body_parser": {
"limit": "110KB"
}
}
}
}

0 comments on commit b82e7ef

Please sign in to comment.