Throw error when query with wrongly encoded parameter
This commit is contained in:
@@ -2,11 +2,22 @@
|
||||
import PromiseRouter from '../PromiseRouter';
|
||||
import rest from '../rest';
|
||||
|
||||
import url from 'url';
|
||||
|
||||
export class ClassesRouter {
|
||||
// Returns a promise that resolves to a {response} object.
|
||||
handleFind(req) {
|
||||
let body = Object.assign(req.body, req.query);
|
||||
let options = {};
|
||||
let allowConstraints = ['skip', 'limit', 'order', 'count', 'keys',
|
||||
'include', 'redirectClassNameForKey', 'where'];
|
||||
|
||||
for (var key in body) {
|
||||
if (allowConstraints.indexOf(key) === -1) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Improper encode of parameter');
|
||||
}
|
||||
}
|
||||
|
||||
if (body.skip) {
|
||||
options.skip = Number(body.skip);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user