Skip to content

Commit 7ee216f

Browse files
committed
Use http.endOfBodyReached() in example instead of tracking body len
1 parent 2551186 commit 7ee216f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/SimpleHttpExample/SimpleHttpExample.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void loop()
8787
char c;
8888
// Whilst we haven't timed out & haven't reached the end of the body
8989
while ( (http.connected() || http.available()) &&
90-
(bodyLen > 0 || bodyLen != HttpClient::kNoContentLengthHeader) &&
90+
(!http.endOfBodyReached()) &&
9191
((millis() - timeoutStart) < kNetworkTimeout) )
9292
{
9393
if (http.available())
@@ -96,7 +96,6 @@ void loop()
9696
// Print out this character
9797
Serial.print(c);
9898

99-
bodyLen--;
10099
// We read something, reset the timeout counter
101100
timeoutStart = millis();
102101
}

0 commit comments

Comments
 (0)