Pass dates to cloud code functions (#655) (#1697)

This commit is contained in:
andrewchae
2016-05-09 10:45:57 -07:00
committed by Drew
parent 37c502bed0
commit 10d2988985

View File

@@ -33,6 +33,14 @@ export class FunctionsRouter extends PromiseRouter {
var theValidator = triggers.getValidator(req.params.functionName, applicationId);
if (theFunction) {
const params = Object.assign({}, req.body, req.query);
for (var key in params) {
if (params.hasOwnProperty(key)) {
var value = params[key];
if (value.__type == 'Date') {
params[key] = new Date(value.iso);
}
}
}
var request = {
params: params,
master: req.auth && req.auth.isMaster,