Skip to content

Commit 46c5755

Browse files
committed
read body of previous HTTP req to clear rx buffer
1 parent 6a08f38 commit 46c5755

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

AdafruitIO_Feed.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ bool AdafruitIO_Feed::exists()
118118
{
119119
_io->_http->startRequest(_feed_url, HTTP_METHOD_GET);
120120
_io->_http->sendHeader("X-AIO-Key", _io->_key);
121+
_io->_http->endRequest();
121122
int status = _io->_http->responseStatusCode();
123+
_io->_http->responseBody(); // needs to be read even if not used
122124
return status == 200;
123125
}
124126

@@ -135,6 +137,7 @@ bool AdafruitIO_Feed::create()
135137
_io->_http->write((const byte*)body.c_str(), body.length());
136138

137139
int status = _io->_http->responseStatusCode();
140+
_io->_http->responseBody(); // needs to be read even if not used
138141
return status == 201;
139142
}
140143

0 commit comments

Comments
 (0)