22#include <boost/beast/http/field.hpp>
23#include <boost/beast/http/message.hpp>
24#include <boost/beast/http/string_body.hpp>
42 using HttpHeaders = boost::beast::http::request<boost::beast::http::string_body>::header_type;
47 std::reference_wrapper<HttpHeaders const> headers;
50 using HttpRequest = boost::beast::http::request<boost::beast::http::string_body>;
51 std::variant<HttpRequest, WsData> data_;
59 explicit Request(boost::beast::http::request<boost::beast::http::string_body> request);
73 enum class Method { Get, Post, Websocket, Unsupported };
96 std::optional<std::reference_wrapper<boost::beast::http::request<boost::beast::http::string_body>
const>>
112 std::optional<std::string_view>
129 std::optional<std::string_view>
130 headerValue(boost::beast::http::field headerName)
const;
138 std::optional<std::string_view>
Represents an HTTP or WebSocket request.
Definition Request.hpp:37
HttpHeaders const & httpHeaders() const
Get the headers of the request.
Definition Request.cpp:110
std::optional< std::reference_wrapper< boost::beast::http::request< boost::beast::http::string_body > const > > asHttpRequest() const
Get the HTTP request.
Definition Request.cpp:84
Method method() const
Get the method of the request.
Definition Request.cpp:62
std::optional< std::string_view > headerValue(boost::beast::http::field headerName) const
Get the value of a header.
Definition Request.cpp:122
Request(boost::beast::http::request< boost::beast::http::string_body > request)
Construct from an HTTP request.
Definition Request.cpp:52
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:93
Method
Method of the request.
Definition Request.hpp:73
std::optional< std::string_view > target() const
Get the target of the request.
Definition Request.cpp:101
boost::beast::http::request< boost::beast::http::string_body >::header_type HttpHeaders
The headers of an HTTP request.
Definition Request.hpp:42
bool isHttp() const
Check if the request is an HTTP request.
Definition Request.cpp:78