Skip to content

Commit

Permalink
Put the allowed query keys for get in a constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjackson89 committed Apr 1, 2016
1 parent fffc83c commit 4fd67a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Routers/ClassesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import rest from '../rest';

import url from 'url';

const ALLOWED_GET_QUERY_KEYS = ['keys', 'include'];

export class ClassesRouter extends PromiseRouter {

handleFind(req) {
Expand Down Expand Up @@ -61,10 +63,9 @@ export class ClassesRouter extends PromiseRouter {
handleGet(req) {
let body = Object.assign(req.body, ClassesRouter.JSONFromQuery(req.query));
let options = {};
let allowConstraints = ['keys', 'include'];

for (let key of Object.keys(body)) {
if (allowConstraints.indexOf(key) === -1) {
if (ALLOWED_GET_QUERY_KEYS.indexOf(key) === -1) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Improper encode of parameter');
}
}
Expand Down

0 comments on commit 4fd67a5

Please sign in to comment.