From adf2266989dfb0d8feabfceaa8e302a28464a255 Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Wed, 2 Mar 2016 16:06:37 -0500 Subject: [PATCH] troubleshoot 655 --- spec/ParseAPI.spec.js | 28 ++++++++++++++++++++++++---- spec/cloud/main.js | 4 ++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/spec/ParseAPI.spec.js b/spec/ParseAPI.spec.js index 2d0eed8038..da228743ef 100644 --- a/spec/ParseAPI.spec.js +++ b/spec/ParseAPI.spec.js @@ -710,9 +710,6 @@ describe('miscellaneous', function() { }); it('test cloud function query parameters', (done) => { - Parse.Cloud.define('echoParams', (req, res) => { - res.success(req.params); - }); var headers = { 'Content-Type': 'application/json', 'X-Parse-Application-Id': 'test', @@ -733,7 +730,6 @@ describe('miscellaneous', function() { // Make sure query string params override body params expect(res.other).toEqual('2'); expect(res.foo).toEqual("bar"); - Parse.Cloud._removeHook("Functions",'echoParams'); done(); }); }); @@ -852,5 +848,29 @@ describe('miscellaneous', function() { done(); }); }); + + it('echo the params as passed', done => { + var headers = { + 'Content-Type': 'application/json', + 'X-Parse-Application-Id': 'test', + 'X-Parse-Javascript-Key': 'test' + }; + request.post({ + headers: headers, + url: 'http://localhost:8378/1/functions/echoParams', + json: { + date: { + __type: "Date", + iso: "2016-02-25T00:00:00.000Z" + }, + }, + }, (error, response, body) => { + expect(error).toBe(null); + var res = body.result; + expect(res.date.__type).toEqual('Date'); + expect(res.date.iso).toEqual("2016-02-25T00:00:00.000Z"); + done(); + }); + }); }); diff --git a/spec/cloud/main.js b/spec/cloud/main.js index 396fa86281..b391bfb232 100644 --- a/spec/cloud/main.js +++ b/spec/cloud/main.js @@ -108,3 +108,7 @@ Parse.Cloud.define('echoKeys', function(req, res){ javascriptKey: Parse.javascriptKey }) }); + +Parse.Cloud.define('echoParams', function(req, res) { + return res.success(req.params); +});