#include <userver/server/http/http_request.hpp>
HTTP Request data.
Definition at line 34 of file http_request.hpp.
Public Types | |
using | HeadersMap = ::http::headers::HeaderMap |
using | HeadersMapKeys = decltype(utils::impl::MakeKeysView(HeadersMap())) |
using | CookiesMap = std::unordered_map<std::string, std::string, utils::StrCaseHash> |
using | CookiesMapKeys = decltype(utils::impl::MakeKeysView(CookiesMap())) |
Public Member Functions | |
HttpRequest (HttpRequest &&)=delete | |
HttpRequest (const HttpRequest &)=delete | |
const HttpMethod & | GetMethod () const |
const std::string & | GetMethodStr () const |
int | GetHttpMajor () const |
int | GetHttpMinor () const |
const std::string & | GetUrl () const |
const std::string & | GetRequestPath () const |
const std::string & | GetHost () const |
const engine::io::Sockaddr & | GetRemoteAddress () const |
const std::string & | GetArg (std::string_view arg_name) const |
const std::vector< std::string > & | GetArgVector (std::string_view arg_name) const |
bool | HasArg (std::string_view arg_name) const |
size_t | ArgCount () const |
std::vector< std::string > | ArgNames () const |
const FormDataArg & | GetFormDataArg (std::string_view arg_name) const |
const std::vector< FormDataArg > & | GetFormDataArgVector (std::string_view arg_name) const |
bool | HasFormDataArg (std::string_view arg_name) const |
size_t | FormDataArgCount () const |
std::vector< std::string > | FormDataArgNames () const |
const std::string & | GetPathArg (std::string_view arg_name) const |
const std::string & | GetPathArg (size_t index) const |
bool | HasPathArg (std::string_view arg_name) const |
bool | HasPathArg (size_t index) const |
size_t | PathArgCount () const |
const std::string & | GetHeader (std::string_view header_name) const |
const std::string & | GetHeader (const ::http::headers::PredefinedHeader &header_name) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | HasHeader (std::string_view header_name) const |
bool | HasHeader (const ::http::headers::PredefinedHeader &header_name) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
size_t | HeaderCount () const |
void | RemoveHeader (std::string_view header_name) |
Removes the header with case insensitive name header_name. | |
void | RemoveHeader (const ::http::headers::PredefinedHeader &header_name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
HeadersMapKeys | GetHeaderNames () const |
const HeadersMap & | GetHeaders () const |
const std::string & | GetCookie (const std::string &cookie_name) const |
bool | HasCookie (const std::string &cookie_name) const |
size_t | CookieCount () const |
CookiesMapKeys | GetCookieNames () const |
const CookiesMap & | RequestCookies () const |
const std::string & | RequestBody () const |
std::string | ExtractRequestBody () |
void | SetResponseStatus (HttpStatus status) const |
Set the response status code. | |
bool | IsBodyCompressed () const |
HttpResponse & | GetHttpResponse () const |
std::chrono::steady_clock::time_point | GetStartTime () const |
Get approximate time point of request handling start. | |
using server::http::HttpRequest::CookiesMap = std::unordered_map<std::string, std::string, utils::StrCaseHash> |
Definition at line 40 of file http_request.hpp.
using server::http::HttpRequest::CookiesMapKeys = decltype(utils::impl::MakeKeysView(CookiesMap())) |
Definition at line 42 of file http_request.hpp.
Definition at line 36 of file http_request.hpp.
using server::http::HttpRequest::HeadersMapKeys = decltype(utils::impl::MakeKeysView(HeadersMap())) |
Definition at line 38 of file http_request.hpp.
size_t server::http::HttpRequest::ArgCount | ( | ) | const |
parse_args_from_body: true
for handler is set). std::vector< std::string > server::http::HttpRequest::ArgNames | ( | ) | const |
parse_args_from_body: true
for handler is set). size_t server::http::HttpRequest::CookieCount | ( | ) | const |
std::string server::http::HttpRequest::ExtractRequestBody | ( | ) |
this
is modified. size_t server::http::HttpRequest::FormDataArgCount | ( | ) | const |
std::vector< std::string > server::http::HttpRequest::FormDataArgNames | ( | ) | const |
const std::string & server::http::HttpRequest::GetArg | ( | std::string_view | arg_name | ) | const |
arg_name
or an empty string if no such argument. Arguments are extracted from:parse_args_from_body: true
for handler is set).In both cases, arg keys and values are url-decoded automatically when parsing into the HttpRequest.
const std::vector< std::string > & server::http::HttpRequest::GetArgVector | ( | std::string_view | arg_name | ) | const |
arg_name
or an empty vector if no such argument. Arguments are extracted from:parse_args_from_body: true
for handler is set).In both cases, arg keys and values are url-decoded automatically when parsing into the HttpRequest.
const std::string & server::http::HttpRequest::GetCookie | ( | const std::string & | cookie_name | ) | const |
CookiesMapKeys server::http::HttpRequest::GetCookieNames | ( | ) | const |
const FormDataArg & server::http::HttpRequest::GetFormDataArg | ( | std::string_view | arg_name | ) | const |
const std::vector< FormDataArg > & server::http::HttpRequest::GetFormDataArgVector | ( | std::string_view | arg_name | ) | const |
const std::string & server::http::HttpRequest::GetHeader | ( | std::string_view | header_name | ) | const |
HeadersMapKeys server::http::HttpRequest::GetHeaderNames | ( | ) | const |
const HeadersMap & server::http::HttpRequest::GetHeaders | ( | ) | const |
const std::string & server::http::HttpRequest::GetHost | ( | ) | const |
int server::http::HttpRequest::GetHttpMajor | ( | ) | const |
int server::http::HttpRequest::GetHttpMinor | ( | ) | const |
const HttpMethod & server::http::HttpRequest::GetMethod | ( | ) | const |
const std::string & server::http::HttpRequest::GetMethodStr | ( | ) | const |
const std::string & server::http::HttpRequest::GetPathArg | ( | size_t | index | ) | const |
const std::string & server::http::HttpRequest::GetPathArg | ( | std::string_view | arg_name | ) | const |
const engine::io::Sockaddr & server::http::HttpRequest::GetRemoteAddress | ( | ) | const |
const std::string & server::http::HttpRequest::GetRequestPath | ( | ) | const |
const std::string & server::http::HttpRequest::GetUrl | ( | ) | const |
bool server::http::HttpRequest::HasArg | ( | std::string_view | arg_name | ) | const |
parse_args_from_body: true
for handler is set).In both cases, arg keys and values are url-decoded automatically when parsing into the HttpRequest.
bool server::http::HttpRequest::HasCookie | ( | const std::string & | cookie_name | ) | const |
bool server::http::HttpRequest::HasFormDataArg | ( | std::string_view | arg_name | ) | const |
bool server::http::HttpRequest::HasHeader | ( | std::string_view | header_name | ) | const |
bool server::http::HttpRequest::HasPathArg | ( | size_t | index | ) | const |
bool server::http::HttpRequest::HasPathArg | ( | std::string_view | arg_name | ) | const |
size_t server::http::HttpRequest::HeaderCount | ( | ) | const |
bool server::http::HttpRequest::IsBodyCompressed | ( | ) | const |
decompress_request
of a handler was set to false
and this is a compressed request. size_t server::http::HttpRequest::PathArgCount | ( | ) | const |
const std::string & server::http::HttpRequest::RequestBody | ( | ) | const |
const CookiesMap & server::http::HttpRequest::RequestCookies | ( | ) | const |
void server::http::HttpRequest::SetResponseStatus | ( | HttpStatus | status | ) | const |
Set the response status code.
Equivalent to this->GetHttpResponse().SetStatus(status).
|
friend |
Definition at line 287 of file http_request.hpp.
|
friend |
Definition at line 288 of file http_request.hpp.