How to clear recveive buffer after read when buffer is reused.
I am using REST protocol with BEAST https. I try to reuse the beast::buffer::flat_buffer.
But I found each time I send a request and read from http::responsehttp::string_body. the buffer didn't clear the result from previous request. For example, first time the server send back "[]", the second time I read is "[][next time result]".
I called response->clear() and buff->consume(0); it does'nt work.
How to clear the buffer after I have processed the result and prepare the buffer for next time read?
*msg = {};
See: https://github.com/boostorg/beast/blob/develop/example/http/server/async/http_server_async.cpp#L284
I call *response = {}, and it works. Thanks.
I called response->clear() and mbuf->consume() but it doesn't work.
This needs to be redesigned to be more obvious