Skip to content

Commit

Permalink
[coro_http_client][fix] release buf (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Aug 22, 2023
1 parent b3f76db commit e6a4cf4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/ylt/thirdparty/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ class coro_http_client {
#endif

// return body_, the user will own body's lifetime.
std::string release_buf() { return std::move(body_); }
std::string release_buf() {
if (body_.empty()) {
return std::move(resp_chunk_str_);
}

return std::move(body_);
}

// only make socket connet(or handshake) to the host
async_simple::coro::Lazy<resp_data> connect(std::string uri) {
Expand Down

0 comments on commit e6a4cf4

Please sign in to comment.