Skip to content

Commit 4b6f4df

Browse files
committed
Add check for bodyLen in read loop
1 parent bfedff8 commit 4b6f4df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/SimpleHttpExample/SimpleHttpExample.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// outputs the content to the serial port
77

88
#include <SPI.h>
9-
#include <ArduinoHttpClient.h>
109
#include <WiFi101.h>
10+
#include <ArduinoHttpClient.h>
1111

1212
// This example downloads the URL "http://arduino.cc/"
1313

@@ -82,6 +82,7 @@ void loop()
8282
char c;
8383
// Whilst we haven't timed out & haven't reached the end of the body
8484
while ( (http.connected() || http.available()) &&
85+
(bodyLen > 0 || bodyLen != HttpClient::kNoContentLengthHeader) &&
8586
((millis() - timeoutStart) < kNetworkTimeout) )
8687
{
8788
if (http.available())

0 commit comments

Comments
 (0)