Skip to content
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

[coro_http_client][feat]support out buf when request #450

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

qicosmos
Copy link
Collaborator

Why

support out buffer when request http.

What is changing

Example

void use_out_buf() {
  using namespace coro_http;
  std::string str;
  str.resize(10);
  std::string url = "http://cn.bing.com";

  str.resize(6400);
  coro_http_client client;
  auto ret = client.async_request(url, http_method::GET, req_context<>{}, {},
                                  std::span<char>{str.data(), str.size()});
  auto result = async_simple::coro::syncAwait(ret);
  bool ok = result.status == 200 || result.status == 301;
  assert(ok);
  std::string_view sv(str.data(), result.resp_body.size());
  assert(result.resp_body == sv);
}

@qicosmos qicosmos merged commit 72253d3 into alibaba:main Sep 12, 2023
29 checks passed
@qicosmos qicosmos deleted the support_out_buf branch September 12, 2023 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant