roar
|
This class extends the boost::beast::http::request<BodyT> with additional convenience. More...
#include <request.hpp>
Public Types | |
using | self_type = Request< BodyT > |
using | beast_request = boost::beast::http::request< BodyT > |
Public Member Functions | |
Request () | |
Request (beast_request req) | |
Construct a new Request object from a beast request to upgrade it. | |
Request (beast_request req, Detail::RequestExtensions &&extensions) | |
Construct a new Request object from a beast request and takes extensions of a previous request object. | |
std::string | path () const |
Returns only the path of the url. | |
void | target (std::string_view target) |
std::string_view | target () const |
Request< BodyT > & | host (std::string &&host) |
Request< BodyT > & | host (std::string const &host) |
Request< BodyT > & | host (std::string_view host) |
Request< BodyT > & | host (char const *host) |
std::string | host () const |
Request< BodyT > & | port (std::string &&port) |
Request< BodyT > & | port (std::string const &port) |
Request< BodyT > & | port (std::string_view port) |
Request< BodyT > & | port (unsigned short port) |
Request< BodyT > & | port (char const *port) |
std::string | port () const |
Request< BodyT > & | setHeader (boost::beast::http::field field, std::string value) |
auto const & | query () const |
Returns the query part of the url as an unordered_map<string, string>. | |
auto const & | pathMatches () const |
Retrieves regex matches for this request with the registered route. | |
Request< BodyT > & | pathMatches (std::vector< std::string > &&matches) |
Sets regex matches for this request with the registered route. | |
template<typename FieldT > | |
std::vector< std::string > | splitCommaSeperatedHeaderEntry (FieldT &&field) const |
Retrieves a header which value is a typically comma seperated list as a vector of string. | |
bool | isWebsocketUpgrade () const |
Is this a websocket upgrade request? | |
Detail::RequestExtensions | ejectExtensions () && |
Rips extensions out of this request object intended to be implanted into another request object. | |
bool | expectsContinue () const |
Returns true if the request expects a continue response. | |
void | expectsContinue (bool enable) |
enables/disables the expect continue header. | |
std::optional< std::size_t > | contentLength () const |
Returns the content length header. | |
void | contentLength (std::size_t length) |
Sets the content length header. | |
std::optional< Ranges > | ranges () const |
Extracts the Range header. | |
std::optional< AuthorizationScheme > | authorizationScheme () const |
Returns the authorization scheme of the Authorization header if it exists. | |
std::optional< BasicAuth > | basicAuth () const |
Returns a basic auth object if the authorization scheme is "Basic". | |
Request< BodyT > & | basicAuth (BasicAuth const &auth) |
std::optional< DigestAuth > | digestAuth () const |
Returns a digest auth object with all digest auth information. | |
Request< BodyT > & | digestAuth (DigestAuth const &auth) |
std::optional< std::string > | bearerAuth () const |
Returns token data of bearer authentication method. | |
Request< BodyT > & | bearerAuth (std::string const &token) |
std::unordered_map< std::string, std::string > | getCookies () const |
Gets all cookies. | |
Private Member Functions | |
void | parseTarget () |
Extracts path and query from boost::beast::http::request::target() | |
std::unordered_map< std::string, std::string > | parseQuery (std::string_view queryString) const |
Transforms the query part from string to map. | |
Additional Inherited Members | |
Private Attributes inherited from Roar::Detail::RequestExtensions | |
std::optional< std::vector< std::string > > | regexMatches_ |
std::string | path_ |
std::unordered_map< std::string, std::string > | query_ |
std::string | host_ |
std::string | port_ |
This class extends the boost::beast::http::request<BodyT> with additional convenience.
BodyT | Body type of the request. (empty_body, string_body, ...) See boost beast bodies. |
using Roar::Request< BodyT >::beast_request = boost::beast::http::request<BodyT> |
using Roar::Request< BodyT >::self_type = Request<BodyT> |
|
inline |
|
inlineexplicit |
Construct a new Request object from a beast request to upgrade it.
req | A beast http request. |
|
inlineexplicit |
Construct a new Request object from a beast request and takes extensions of a previous request object.
req |
|
inline |
Returns the authorization scheme of the Authorization header if it exists.
|
inline |
Returns a basic auth object if the authorization scheme is "Basic".
|
inline |
|
inline |
Returns token data of bearer authentication method.
|
inline |
|
inline |
Returns the content length header.
|
inline |
Sets the content length header.
length |
|
inline |
Returns a digest auth object with all digest auth information.
|
inline |
|
inline |
Rips extensions out of this request object intended to be implanted into another request object.
|
inline |
Returns true if the request expects a continue response.
|
inline |
enables/disables the expect continue header.
enable |
|
inline |
Gets all cookies.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Is this a websocket upgrade request?
|
inlineprivate |
Transforms the query part from string to map.
queryString | The query as a complete string. |
|
inlineprivate |
Extracts path and query from boost::beast::http::request::target()
|
inline |
Returns only the path of the url.
|
inline |
Retrieves regex matches for this request with the registered route.
|
inline |
Sets regex matches for this request with the registered route.
matches | matches[0] = full match, matches[1] = first capture group, ... |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the query part of the url as an unordered_map<string, string>.
|
inline |
Extracts the Range header.
|
inline |
|
inline |
Retrieves a header which value is a typically comma seperated list as a vector of string.
|
inline |
|
inline |