Skip to content

Commit 6242b4a

Browse files
authored
Merge pull request #362 from talanta/master
Remove Url.parse limit of parameters (default 1000)
2 parents c89d966 + 1d998c9 commit 6242b4a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

documentation/configuring.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ jsonApi.setConfig({
3131
// such as the maximum allowed body size (default is 100kb). All the options are
3232
// documented at https://github.com/expressjs/body-parser#bodyparserjsonoptions
3333
bodyParserJsonOpts: {
34-
limit: '256kb',
35-
}
34+
limit: '256kb'
35+
},
36+
// (optional) queryStringParsingParameterLimit allows to
37+
// override the default limit of 1000 parameters in query string parsing,
38+
// documented at : https://github.com/ljharb/qs
39+
queryStringParsingParameterLimit: Infinity
3640
});
3741
```
3842

lib/rerouter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ rerouter.route = (newRequest, callback) => {
1515

1616
const path = rerouter._generateSanePath(newRequest)
1717
const route = rerouter._pickFirstMatchingRoute(validRoutes, path)
18-
18+
const qsOpts = jsonApi._apiConfig.queryStringParsingParameterLimit
19+
? { parameterLimit: jsonApi._apiConfig.queryStringParsingParameterLimit }
20+
: { }
1921
const req = {
2022
url: newRequest.uri,
2123
originalUrl: newRequest.originalRequest.originalUrl,
2224
headers: newRequest.originalRequest.headers,
2325
cookies: newRequest.originalRequest.cookies,
24-
params: rerouter._mergeParams(url.parse(newRequest.uri.split('?')[1] || { }), newRequest.params)
26+
params: rerouter._mergeParams(url.parse(newRequest.uri.split('?')[1] || { }, qsOpts), newRequest.params)
2527
}
2628
rerouter._extendUrlParamsOntoReq(route, path, req)
2729

0 commit comments

Comments
 (0)