From f572e1593851cc02e2c7fae70fd036bc311dfb4f Mon Sep 17 00:00:00 2001 From: qicosmos Date: Tue, 26 Sep 2023 15:11:42 +0800 Subject: [PATCH] fix --- include/cinatra/coro_http_client.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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));