From b090090aeb3587226f671391f899f78ec9b1e2a1 Mon Sep 17 00:00:00 2001 From: Alexey Timin Date: Tue, 6 Aug 2024 15:04:46 +0200 Subject: [PATCH] fix build --- src/reduct/internal/http_client.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/reduct/internal/http_client.cc b/src/reduct/internal/http_client.cc index d2eb114..e8360d6 100644 --- a/src/reduct/internal/http_client.cc +++ b/src/reduct/internal/http_client.cc @@ -16,6 +16,17 @@ using httplib::DataSink; constexpr size_t kMaxChunkSize = 512'000; +Result NormalizeHeaders(httplib::Result res) { + IHttpClient::Headers response_headers; + for (auto& [k, v] : res->headers) { + std::string lowcase_header = k; + std::transform(k.begin(), k.end(), lowcase_header.begin(), [](auto ch) { return tolower(ch); }); + response_headers[lowcase_header] = v; + } + + return {std::move(response_headers), Error::kOk}; +} + class HttpClient : public IHttpClient { public: explicit HttpClient(std::string_view url, const HttpOptions& options) @@ -121,7 +132,7 @@ class HttpClient : public IHttpClient { return {{}, std::move(err)}; } - return NormilizeHeaders(std::move(res)); + return NormalizeHeaders(std::move(res)); } Error Put(std::string_view path, std::string_view body, std::string_view mime) const noexcept override { @@ -139,7 +150,7 @@ class HttpClient : public IHttpClient { return {{}, std::move(err)}; } - return NormilizeHeaders(std::move(res)); + return NormalizeHeaders(std::move(res)); } Error Delete(std::string_view path) const noexcept override { @@ -213,15 +224,4 @@ bool IsCompatible(std::string_view min, std::string_view version) { return min_version[0] == current_version[0] && min_version[1] <= current_version[1]; } -Result NormilizeHeaders(httplib::Result res) { - IHttpClient::Headers response_headers; - for (auto& [k, v] : res->headers) { - std::string lowcase_header = k; - std::transform(k.begin(), k.end(), lowcase_header.begin(), [](auto ch) { return tolower(ch); }); - response_headers[lowcase_header] = v; - } - - return {std::move(response_headers), Error::kOk}; -} - } // namespace reduct::internal