-
Notifications
You must be signed in to change notification settings - Fork 13.3k
HTTPClient.getString() returns payload on first call only and returns empty after #4951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is by design, because the response is read directly from the incomming Stream, see function from ESP8266HTTPClient.cpp:
If the response is needed more than once, the sketch should use the String variable to which the payload is assigned (String first in the above example). |
@Jeroen88 :
But normally the getter functions ( as here getString()) return the value of a Class value not only once. |
Platform
Settings in IDE
Problem Description
Might be working as intended but took me some time to find out when I was creating a small test program.
When the HTTPClient.GET() has finished, the payload can be retrieved with HTTPClient.getString() returns the payload.
However, when calling multiple times, only the first will return the payload, each subsequent call returns empty string.
Results in Serial output.
The text was updated successfully, but these errors were encountered: