Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST: Bad Request in case of JSON #20

Open
pratibimb opened this issue Sep 4, 2017 · 2 comments
Open

POST: Bad Request in case of JSON #20

pratibimb opened this issue Sep 4, 2017 · 2 comments

Comments

@pratibimb
Copy link

pratibimb commented Sep 4, 2017

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.

@garvamel
Copy link

Make a pull request please, this is very useful. Thanks for the attached file!

@joaquinseco
Copy link

joaquinseco commented Nov 25, 2017

@pratibimb: DId you finally do the Pull Request?. I have lost hours to detect this same error, and when I was going to report de issue, I've seen you had already found this bug :(

Thank yoy very much @pratibimb and of couse, thank you very much @garvamel for this fantasctic job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants