#include <userver/server/http/http_response.hpp>
HTTP Response data.
Definition at line 35 of file http_response.hpp.
Public Types | |
using | HeadersMap = ::http::headers::HeaderMap |
using | HeadersMapKeys = decltype(utils::impl::MakeKeysView(HeadersMap())) |
using | CookiesMap = Cookie::CookiesMap |
using | CookiesMapKeys = decltype(utils::impl::MakeKeysView(CookiesMap())) |
using | Queue = concurrent::StringStreamQueue |
Public Member Functions | |
bool | SetHeader (std::string name, std::string value) |
Add a new response header or rewrite an existing one. | |
bool | SetHeader (std::string_view name, std::string value) |
Add a new response header or rewrite an existing one. | |
bool | SetHeader (const ::http::headers::PredefinedHeader &header, std::string value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | SetContentType (const ::http::ContentType &type) |
Add or rewrite the Content-Type header. | |
void | SetContentEncoding (std::string encoding) |
Add or rewrite the Content-Encoding header. | |
bool | SetStatus (HttpStatus status) |
Set the HTTP response status code. | |
bool | ClearHeaders () |
Remove all headers from response. | |
void | SetCookie (Cookie cookie) |
Sets a cookie if it was not set before. | |
void | ClearCookies () |
Remove all cookies from response. | |
HttpStatus | GetStatus () const |
HeadersMapKeys | GetHeaderNames () 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. | |
CookiesMapKeys | GetCookieNames () const |
const Cookie & | GetCookie (std::string_view cookie_name) const |
void | SetStatusServiceUnavailable () override |
void | SetStatusOk () override |
void | SetStatusNotFound () override |
bool | WaitForHeadersEnd () override |
void | SetHeadersEnd () override |
void | SetStreamBody () |
bool | IsBodyStreamed () const override |
Queue::Producer | GetBodyProducer () |
Public Member Functions inherited from server::request::ResponseBase | |
ResponseBase (ResponseDataAccounter &data_accounter) | |
ResponseBase (const ResponseBase &)=delete | |
ResponseBase (ResponseBase &&)=delete | |
void | SetData (std::string data) |
const std::string & | GetData () const |
Additional Inherited Members | |
Protected Member Functions inherited from server::request::ResponseBase | |
ResponseBase (ResponseDataAccounter &data_account, std::chrono::steady_clock::time_point now) | |
void | SetSent (std::size_t bytes_sent, std::chrono::steady_clock::time_point sent_time) |
using server::http::HttpResponse::CookiesMap = Cookie::CookiesMap |
Definition at line 41 of file http_response.hpp.
using server::http::HttpResponse::CookiesMapKeys = decltype(utils::impl::MakeKeysView(CookiesMap())) |
Definition at line 43 of file http_response.hpp.
Definition at line 37 of file http_response.hpp.
using server::http::HttpResponse::HeadersMapKeys = decltype(utils::impl::MakeKeysView(HeadersMap())) |
Definition at line 39 of file http_response.hpp.
Definition at line 137 of file http_response.hpp.
bool server::http::HttpResponse::ClearHeaders | ( | ) |
Remove all headers from response.
const Cookie & server::http::HttpResponse::GetCookie | ( | std::string_view | cookie_name | ) | const |
CookiesMapKeys server::http::HttpResponse::GetCookieNames | ( | ) | const |
const std::string & server::http::HttpResponse::GetHeader | ( | std::string_view | header_name | ) | const |
HeadersMapKeys server::http::HttpResponse::GetHeaderNames | ( | ) | const |
|
inline |
Definition at line 96 of file http_response.hpp.
bool server::http::HttpResponse::HasHeader | ( | std::string_view | header_name | ) | const |
|
overridevirtual |
Implements server::request::ResponseBase.
bool server::http::HttpResponse::SetHeader | ( | std::string | name, |
std::string | value ) |
Add a new response header or rewrite an existing one.
bool server::http::HttpResponse::SetHeader | ( | std::string_view | name, |
std::string | value ) |
Add a new response header or rewrite an existing one.
|
overridevirtual |
Implements server::request::ResponseBase.
bool server::http::HttpResponse::SetStatus | ( | HttpStatus | status | ) |
Set the HTTP response status code.
|
inlineoverride |
Definition at line 132 of file http_response.hpp.
|
inlineoverride |
Definition at line 131 of file http_response.hpp.
|
inlineoverride |
Definition at line 128 of file http_response.hpp.
|
overridevirtual |
Implements server::request::ResponseBase.