diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2020-05-19 12:44:55 +0300 |
---|---|---|
committer | Daria Volvenkova <dvolvenkova@gmail.com> | 2020-05-19 20:16:05 +0300 |
commit | 43564cbf55b3b813c5a150d414faa34383a1994c (patch) | |
tree | 4aaf40d85f7ddc84b21dfafdc05fda018752d192 /web_api | |
parent | ef87e029f1394a01fbe6087387b1ad5a93430ef7 (diff) |
[guides on map] no need to send all catalog headers into guides on map requests.
Diffstat (limited to 'web_api')
-rw-r--r-- | web_api/request_headers.cpp | 15 | ||||
-rw-r--r-- | web_api/request_headers.hpp | 1 |
2 files changed, 12 insertions, 4 deletions
diff --git a/web_api/request_headers.cpp b/web_api/request_headers.cpp index 2decb9fe55..a9532936fd 100644 --- a/web_api/request_headers.cpp +++ b/web_api/request_headers.cpp @@ -39,16 +39,23 @@ platform::HttpClient::Headers GetDefaultAuthHeaders() return result; } +platform::HttpClient::Header GetPositionHeader(m2::PointD const & pos) +{ + std::ostringstream latLonStream; + auto const latLon = mercator::ToLatLon(pos); + latLonStream << std::fixed << std::setprecision(3) << latLon.m_lat << "," << latLon.m_lon; + + return {kLatLonHeader, latLonStream.str()}; +} + platform::HttpClient::Headers GetCatalogHeaders(HeadersParams const & params) { platform::HttpClient::Headers result = GetDefaultCatalogHeaders(); if (params.m_currentPosition) { - std::ostringstream latLonStream; - auto const latLon = mercator::ToLatLon(*params.m_currentPosition); - latLonStream << std::fixed << std::setprecision(3) << latLon.m_lat << "," << latLon.m_lon; - result.emplace(kLatLonHeader, latLonStream.str()); + auto const latLon = GetPositionHeader(*params.m_currentPosition); + result.emplace(latLon.m_name, latLon.m_value); } if (!params.m_cityGeoIds.empty()) diff --git a/web_api/request_headers.hpp b/web_api/request_headers.hpp index 99d49c5f7a..0cc96e8e78 100644 --- a/web_api/request_headers.hpp +++ b/web_api/request_headers.hpp @@ -21,5 +21,6 @@ public: platform::HttpClient::Headers GetDefaultCatalogHeaders(); platform::HttpClient::Headers GetDefaultAuthHeaders(); +platform::HttpClient::Header GetPositionHeader(m2::PointD const & pos); platform::HttpClient::Headers GetCatalogHeaders(HeadersParams const & params); } // namespace web_api |