@@ -1119,6 +1119,22 @@ describe('miscellaneous', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can handle null params in cloud functions (regression test for #1742)', done => {
|
||||||
|
Parse.Cloud.define('func', (request, response) => {
|
||||||
|
expect(request.params.nullParam).toEqual(null);
|
||||||
|
response.success('yay');
|
||||||
|
});
|
||||||
|
|
||||||
|
Parse.Cloud.run('func', {nullParam: null})
|
||||||
|
.then(() => {
|
||||||
|
Parse.Cloud._removeHook('Functions', 'func');
|
||||||
|
done()
|
||||||
|
}, e => {
|
||||||
|
fail('cloud code call failed');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('fails on invalid client key', done => {
|
it('fails on invalid client key', done => {
|
||||||
var headers = {
|
var headers = {
|
||||||
'Content-Type': 'application/octet-stream',
|
'Content-Type': 'application/octet-stream',
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export class FunctionsRouter extends PromiseRouter {
|
|||||||
for (var key in params) {
|
for (var key in params) {
|
||||||
if (params.hasOwnProperty(key)) {
|
if (params.hasOwnProperty(key)) {
|
||||||
var value = params[key];
|
var value = params[key];
|
||||||
if (value.__type == 'Date') {
|
if (value && value.__type == 'Date') {
|
||||||
params[key] = new Date(value.iso);
|
params[key] = new Date(value.iso);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user