Skip to content

Commit 1d998c9

Browse files
authored
Merge branch 'master' into master
2 parents 97d2c32 + c89d966 commit 1d998c9

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

documentation/configuring.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jsonApi.setConfig({
2727
meta: function(request) {
2828
return { timestamp: new Date() };
2929
},
30+
// (optional) bodyParserJsonOpts allows setting the options passed to the json body parser,
31+
// such as the maximum allowed body size (default is 100kb). All the options are
32+
// documented at https://github.com/expressjs/body-parser#bodyparserjsonoptions
33+
bodyParserJsonOpts: {
34+
limit: '256kb'
35+
},
3036
// (optional) queryStringParsingParameterLimit allows to
3137
// override the default limit of 1000 parameters in query string parsing,
3238
// documented at : https://github.com/ljharb/qs

lib/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ router.applyMiddleware = () => {
6666
return next()
6767
})
6868

69-
app.use(bodyParser.json())
69+
app.use(bodyParser.json(jsonApi._apiConfig.bodyParserJsonOpts))
7070
app.use(bodyParser.urlencoded({ extended: true }))
7171
app.use(cookieParser())
7272
if (!jsonApi._apiConfig.router) {

lib/routes/helper.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ helper.verifyRequest = (request, resourceConfig, res, handlerRequest, callback)
7171
})
7272
}
7373

74-
if (!resourceConfig.handlers[handlerRequest]) {
74+
// for crud operation support, we need skip over any ChainHandlers to check what the actual store supports
75+
let finalHandler = resourceConfig.handlers
76+
while (finalHandler.otherHandler) {
77+
finalHandler = finalHandler.otherHandler
78+
}
79+
80+
if (!finalHandler[handlerRequest]) {
7581
return helper.handleError(request, res, {
7682
status: '403',
7783
code: 'EFORBIDDEN',

0 commit comments

Comments
 (0)