diff --git a/include/cinatra/coro_http_client.hpp b/include/cinatra/coro_http_client.hpp index a3e67fb4..cd643d0d 100644 --- a/include/cinatra/coro_http_client.hpp +++ b/include/cinatra/coro_http_client.hpp @@ -763,7 +763,12 @@ class coro_http_client { } } - add_header("Transfer-Encoding", "chunked"); + if (headers.empty()) { + add_header("Transfer-Encoding", "chunked"); + } + else { + headers.emplace("Transfer-Encoding", "chunked"); + } std::string header_str = build_request_header(u, method, ctx, true, std::move(headers));