Add maxLimit server configuration (#4048)
* Add maxLimit server configuration * Fix maxlimit validation logic to correctly handle maxLimit:0 case
This commit is contained in:
committed by
Florent Vilmart
parent
976da4d715
commit
23bffc8883
@@ -15,6 +15,10 @@ export class ClassesRouter extends PromiseRouter {
|
||||
handleFind(req) {
|
||||
const body = Object.assign(req.body, ClassesRouter.JSONFromQuery(req.query));
|
||||
const options = ClassesRouter.optionsFromBody(body);
|
||||
if (req.config.maxLimit && (body.limit > req.config.maxLimit)) {
|
||||
// Silently replace the limit on the query with the max configured
|
||||
options.limit = Number(req.config.maxLimit);
|
||||
}
|
||||
if (body.redirectClassNameForKey) {
|
||||
options.redirectClassNameForKey = String(body.redirectClassNameForKey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user