You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a cloud code function via REST API and passing a parameter without value, should the request parameter be undefined in Cloud Code?
Steps to reproduce
Create a Cloud Code function:
Parse.Cloud.define("checkP", function(request, response) {
var p = request.params.p;
if (p === undefined) {
response.error("p not set");
return;
}
response.success();
}
Call the function using the REST API and pass the parameter p without value.
Expected Results
Cloud code should execute response.error("p not set");
Actual Outcome
Cloud code executes response.success();
So a double check is necessary in Cloud Code to account for value-less parameters: if (p === undefined || p == "") {...}
Environment Setup
Server
parse-server version (Be specific! Don't say 'latest'.) : 2.5.3
calling REST API with postman, setting parameter key p without value
Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku
The text was updated successfully, but these errors were encountered:
mtrezza
changed the title
Should Cloud Code parameter be undefined if it has no value?
Should Cloud Code parameter be undefined if passed without value?
Jul 6, 2017
Issue Description
When calling a cloud code function via REST API and passing a parameter without value, should the request parameter be undefined in Cloud Code?
Steps to reproduce
p
without value.Expected Results
Cloud code should execute
response.error("p not set");
Actual Outcome
Cloud code executes
response.success();
So a double check is necessary in Cloud Code to account for value-less parameters:
if (p === undefined || p == "") {...}
Environment Setup
p
without valueThe text was updated successfully, but these errors were encountered: