From 7ee216f4aaaa633aa26a1dcf3658dd51a042010e Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 17 Jun 2016 14:58:17 -0400 Subject: [PATCH] Use http.endOfBodyReached() in example instead of tracking body len --- examples/SimpleHttpExample/SimpleHttpExample.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/SimpleHttpExample/SimpleHttpExample.ino b/examples/SimpleHttpExample/SimpleHttpExample.ino index 79ac237..550015a 100644 --- a/examples/SimpleHttpExample/SimpleHttpExample.ino +++ b/examples/SimpleHttpExample/SimpleHttpExample.ino @@ -87,7 +87,7 @@ void loop() char c; // Whilst we haven't timed out & haven't reached the end of the body while ( (http.connected() || http.available()) && - (bodyLen > 0 || bodyLen != HttpClient::kNoContentLengthHeader) && + (!http.endOfBodyReached()) && ((millis() - timeoutStart) < kNetworkTimeout) ) { if (http.available()) @@ -96,7 +96,6 @@ void loop() // Print out this character Serial.print(c); - bodyLen--; // We read something, reset the timeout counter timeoutStart = millis(); }