Skip to content

Commit

Permalink
Copied PR8784 for v6.x.x fix
Browse files Browse the repository at this point in the history
Copied parse-community#8784 for V6.x.x fix
  • Loading branch information
jaysonng committed Mar 14, 2024
1 parent b8535b3 commit 9404271
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 19 additions & 0 deletions spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,25 @@ describe('miscellaneous', function () {
});
});

it('test cloud function query parameters with array of pointers', async () => {
Parse.Cloud.define('echoParams', req => {
return req.params;
});
const headers = {
'Content-Type': 'application/json',
'X-Parse-Application-Id': 'test',
'X-Parse-Javascript-Key': 'test',
};
const response = await request({
method: 'POST',
headers: headers,
url: 'http://localhost:8378/1/functions/echoParams',
body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest" }]}',
});
const res = response.data.result;
expect(res.arr.length).toEqual(1);
});

it('can handle null params in cloud functions (regression test for #1742)', done => {
Parse.Cloud.define('func', request => {
expect(request.params.nullParam).toEqual(null);
Expand Down
3 changes: 1 addition & 2 deletions src/Routers/FunctionsRouter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// FunctionsRouter.js

var Parse = require('parse/node').Parse,
triggers = require('../triggers');

Expand All @@ -12,7 +11,7 @@ import { logger } from '../logger';
function parseObject(obj, config) {
if (Array.isArray(obj)) {
return obj.map(item => {
return parseObject(item);
return parseObject(item, config);
});
} else if (obj && obj.__type == 'Date') {
return Object.assign(new Date(obj.iso), obj);
Expand Down

0 comments on commit 9404271

Please sign in to comment.