3#include <boost/beast/http/field.hpp>
4#include <boost/beast/http/message.hpp>
5#include <boost/beast/http/string_body.hpp>
23 using HttpHeaders = boost::beast::http::request<boost::beast::http::string_body>::header_type;
28 std::reference_wrapper<HttpHeaders const> headers;
31 using HttpRequest = boost::beast::http::request<boost::beast::http::string_body>;
32 std::variant<HttpRequest, WsData> data_;
40 explicit Request(boost::beast::http::request<boost::beast::http::string_body> request);
55 enum class Method { Get, Post, Websocket, Unsupported };
79 std::reference_wrapper<boost::beast::http::request<boost::beast::http::string_body>
const>>
96 std::optional<std::string_view>
113 std::optional<std::string_view>
114 headerValue(boost::beast::http::field headerName)
const;
122 std::optional<std::string_view>
HttpHeaders const & httpHeaders() const
Get the headers of the request.
Definition Request.cpp:93
std::optional< std::reference_wrapper< boost::beast::http::request< boost::beast::http::string_body > const > > asHttpRequest() const
Get the HTTP request.
Definition Request.cpp:67
Method method() const
Get the method of the request.
Definition Request.cpp:44
std::optional< std::string_view > headerValue(boost::beast::http::field headerName) const
Get the value of a header.
Definition Request.cpp:105
Request(boost::beast::http::request< boost::beast::http::string_body > request)
Construct from an HTTP request.
Definition Request.cpp:33
std::string_view message() const
Get the body (in case of an HTTP request) or the message (in case of a WebSocket request).
Definition Request.cpp:76
Method
Method of the request.
Definition Request.hpp:55
std::optional< std::string_view > target() const
Get the target of the request.
Definition Request.cpp:84
boost::beast::http::request< boost::beast::http::string_body >::header_type HttpHeaders
The headers of an HTTP request.
Definition Request.hpp:23
bool isHttp() const
Check if the request is an HTTP request.
Definition Request.cpp:60