Make resHandler const
cppcheck correctly notes this parameter can be const.
Unfortunately we've making a copy here, but looking at the ownership,
that can't be avoided simply without a shared_ptr, and that's far more
invasive.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib70c89a7a1bc7210219052ba2a44bc7a1c20c7f2
diff --git a/http/http_client.hpp b/http/http_client.hpp
index fe5ef8e..1568b25 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -503,7 +503,7 @@
const boost::beast::http::fields& httpHeader,
const boost::beast::http::verb verb,
const RetryPolicyData& retryPolicy,
- std::function<void(Response&)>& resHandler)
+ const std::function<void(Response&)>& resHandler)
{
std::weak_ptr<ConnectionPool> weakSelf = weak_from_this();
@@ -674,7 +674,7 @@
const boost::beast::http::fields& httpHeader,
const boost::beast::http::verb verb,
const std::string& retryPolicyName,
- std::function<void(Response&)>& resHandler)
+ const std::function<void(Response&)>& resHandler)
{
std::string clientKey = destIP + ":" + std::to_string(destPort);
// Use nullptr to avoid creating a ConnectionPool each time