feat: Healthcheck endpoint (#1751)

Fixes #1759
This commit is contained in:
Alex Kremer
2024-11-26 13:56:25 +00:00
committed by GitHub
parent 541bf4395f
commit fd73b90416
6 changed files with 82 additions and 19 deletions

View File

@@ -36,6 +36,7 @@
#include <boost/beast/http.hpp> // IWYU pragma: keep
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/status.hpp>
#include <boost/beast/http/string_body.hpp>
#include <boost/beast/http/verb.hpp>
#include <boost/beast/http/write.hpp> // IWYU pragma: keep
@@ -58,7 +59,7 @@ using tcp = boost::asio::ip::tcp;
namespace {
std::string
std::pair<boost::beast::http::status, std::string>
syncRequest(
std::string const& host,
std::string const& port,
@@ -96,7 +97,7 @@ syncRequest(
boost::beast::error_code ec;
stream.socket().shutdown(tcp::socket::shutdown_both, ec);
return res.body();
return {res.result(), res.body()};
}
} // namespace
@@ -105,7 +106,7 @@ WebHeader::WebHeader(http::field name, std::string value) : name(name), value(st
{
}
std::string
std::pair<boost::beast::http::status, std::string>
HttpSyncClient::post(
std::string const& host,
std::string const& port,
@@ -116,7 +117,7 @@ HttpSyncClient::post(
return syncRequest(host, port, body, std::move(additionalHeaders), http::verb::post);
}
std::string
std::pair<boost::beast::http::status, std::string>
HttpSyncClient::get(
std::string const& host,
std::string const& port,