csquared / arduino-restclient

Arduino RESTful HTTP Request Library
MIT License
205 stars 133 forks source link

Add a setContentType method and fix readResponse to return entire response #6

Closed IanMercer closed 9 years ago

IanMercer commented 10 years ago

Add a setContentType method and preserve the existing default value Fix readResponse to return the whole of the response not just the first line Fix: Once in the httpBody you don't need to keep looking for the blank line

csquared commented 10 years ago

This looks good! I will merge as soon as I can test later. Thanks!

mschaeuble commented 9 years ago

I had to remove the following lines from your patch:

if (!client.available()) {
    HTTP_DEBUG_PRINT("HTTP: client no longer available\n");
    return code;
}

When they had been in there, connection was dropped too early sometimes.

eigilsagafos commented 9 years ago

@mschaeuble Thanks for a great library. Awesome for an Arduino beginner :) I have a rails app responding to a post request. Local everything works fine, but when deployed on Heroku the Arduino hangs. In debug mode I see that HTTP_DEBUG_PRINT(".") is just spitting out '.' forever. The code above that you removed fixed the problem for me. Haven't done very many tests, but so far I have not had a problem with the connection closing to early.

csquared commented 9 years ago

Thanks for the commit @IanMercer i'm going to manually make the change @mschaeuble suggested.