(req)
| 20 | } |
| 21 | |
| 22 | handleFind(req) { |
| 23 | const body = Object.assign(req.body || {}, ClassesRouter.JSONFromQuery(req.query)); |
| 24 | const options = ClassesRouter.optionsFromBody(body, req.config.defaultLimit); |
| 25 | if (req.config.maxLimit && body.limit > req.config.maxLimit) { |
| 26 | // Silently replace the limit on the query with the max configured |
| 27 | options.limit = Number(req.config.maxLimit); |
| 28 | } |
| 29 | if (body.redirectClassNameForKey) { |
| 30 | options.redirectClassNameForKey = String(body.redirectClassNameForKey); |
| 31 | } |
| 32 | if (typeof body.where === 'string') { |
| 33 | try { |
| 34 | body.where = JSON.parse(body.where); |
| 35 | } catch { |
| 36 | throw new Parse.Error(Parse.Error.INVALID_JSON, 'where parameter is not valid JSON'); |
| 37 | } |
| 38 | } |
| 39 | return rest |
| 40 | .find( |
| 41 | req.config, |
| 42 | req.auth, |
| 43 | this.className(req), |
| 44 | body.where, |
| 45 | options, |
| 46 | req.info.clientSDK, |
| 47 | req.info.context |
| 48 | ) |
| 49 | .then(response => { |
| 50 | return { response: response }; |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | // Returns a promise for a {response} object. |
| 55 | handleGet(req) { |
no test coverage detected