Skip to content

POST: Bad Request in case of JSON #20

Open
@pratibimb

Description

@pratibimb

While making RESTful POST request to my ParseServer (http://parseplatform.org/) I kept on getting the BAD REQUEST error as the server was not able to understand the JSON.

Upon comparing the request with the one from POSTMAN tool, I found that there should be a blank row between the last header and the JSON.

Request.txt

For this reason, I updated following code in RestClient.cpp to make it work.

if(body != NULL){
request += "\r\n"; // Added to make JSON post request work.
request += String(body);
request += "\r\n\r\n";
}

In case you think this helps then do incorporate this logic for POST requests with JSON.
The new file is as attached.
RestClient.h.txt

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions