From 56ae875861ab260b80a030f50c4aff9f9dc8fff0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:32:39 +0200 Subject: Adding upstream version 2.14.2. Signed-off-by: Daniel Baumann --- lib/remote/httputility.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/remote/httputility.hpp (limited to 'lib/remote/httputility.hpp') diff --git a/lib/remote/httputility.hpp b/lib/remote/httputility.hpp new file mode 100644 index 0000000..6465b4a --- /dev/null +++ b/lib/remote/httputility.hpp @@ -0,0 +1,33 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef HTTPUTILITY_H +#define HTTPUTILITY_H + +#include "remote/url.hpp" +#include "base/dictionary.hpp" +#include +#include + +namespace icinga +{ + +/** + * Helper functions. + * + * @ingroup remote + */ +class HttpUtility +{ + +public: + static Dictionary::Ptr FetchRequestParameters(const Url::Ptr& url, const std::string& body); + static Value GetLastParameter(const Dictionary::Ptr& params, const String& key); + + static void SendJsonBody(boost::beast::http::response& response, const Dictionary::Ptr& params, const Value& val); + static void SendJsonError(boost::beast::http::response& response, const Dictionary::Ptr& params, const int code, + const String& verbose = String(), const String& diagnosticInformation = String()); +}; + +} + +#endif /* HTTPUTILITY_H */ -- cgit v1.2.3