1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-04-19 21:22:15 +03:00

Use http.endOfBodyReached() in example instead of tracking body len

This commit is contained in:
Sandeep Mistry 2016-06-17 14:58:17 -04:00
parent 255118660b
commit 7ee216f4aa

View File

@ -87,7 +87,7 @@ void loop()
char c; char c;
// Whilst we haven't timed out & haven't reached the end of the body // Whilst we haven't timed out & haven't reached the end of the body
while ( (http.connected() || http.available()) && while ( (http.connected() || http.available()) &&
(bodyLen > 0 || bodyLen != HttpClient::kNoContentLengthHeader) && (!http.endOfBodyReached()) &&
((millis() - timeoutStart) < kNetworkTimeout) ) ((millis() - timeoutStart) < kNetworkTimeout) )
{ {
if (http.available()) if (http.available())
@ -96,7 +96,6 @@ void loop()
// Print out this character // Print out this character
Serial.print(c); Serial.print(c);
bodyLen--;
// We read something, reset the timeout counter // We read something, reset the timeout counter
timeoutStart = millis(); timeoutStart = millis();
} }