-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
ESP8266HTTPClient: allow getString() more than once #5091
Conversation
I choose to store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to clear the contents, i.e.: once _payload is set, the mem is held forever, or until the next string arrives and it is set again.
I don't see an easy way to fix that.
My guess is that what should happen is that the getString() implementation shouldn't be based on writeToStream(), because streams inherently consume input, but I don't know what the solution should look like.
The entire payload has to be buffered somewhere in memory. If |
Agreed on making clear public, sounds like a good enough compromise. Edit: On second thought, it's not a good idea to expose clear(), it will be confusing to have both an end() and a clear(). Instead, I think end() should call clear(). |
Intuitively (and according to Arduino’s docs), the sketch invokes How about:
|
Refactoring basics :) please go ahead! |
"end = disconnect + clear" design has been implemented. |
fixes #4951