Skip to content

Should Cloud Code parameter be undefined if passed without value? #4001

Closed
@mtrezza

Description

@mtrezza

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

  1. 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();
}
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions