Common status and header data of an HTTP response.
More...
#include <kaycxx/http/response_base.hpp>
|
| int | status_code () const noexcept |
| | Returns the HTTP status code.
|
| const std::vector< kaycxx::http::header > & | headers () const &noexcept |
| | Returns all response headers in their received order.
|
| std::vector< kaycxx::http::header > | headers () &&noexcept |
| | Moves all response headers out of an expiring response.
|
| std::optional< std::string_view > | header (std::string_view name) const &noexcept |
| | Returns the first value of a response header using an ASCII case-insensitive name comparison.
|
| std::optional< std::string > | header (std::string_view name) &&noexcept |
| | Moves the first value of a response header out of an expiring response using an ASCII case-insensitive name comparison.
|
| std::vector< std::string > | headers (std::string_view name) const |
| | Returns all values of a response header using an ASCII case-insensitive name comparison.
|
|
| | response_base (int status_code, std::vector< kaycxx::http::header > headers) |
| | Creates common HTTP response data.
|
|
| response_base (const response_base &)=default |
| | Copies common HTTP response data.
|
|
| response_base (response_base &&) noexcept=default |
| | Moves common HTTP response data.
|
|
response_base & | operator= (const response_base &)=default |
| | Copies common HTTP response data.
|
|
response_base & | operator= (response_base &&) noexcept=default |
| | Moves common HTTP response data.
|
|
| ~response_base ()=default |
| | Destroys common HTTP response data.
|
Common status and header data of an HTTP response.
◆ response_base()
| kaycxx::http::response_base::response_base |
( |
int | status_code, |
|
|
std::vector< kaycxx::http::header > | headers ) |
|
protected |
Creates common HTTP response data.
- Parameters
-
| status_code | HTTP status code. |
| headers | Response headers. |
◆ header() [1/2]
| std::optional< std::string > kaycxx::http::response_base::header |
( |
std::string_view | name | ) |
&& |
|
nodiscardnoexcept |
Moves the first value of a response header out of an expiring response using an ASCII case-insensitive name comparison.
- Parameters
-
- Returns
- First matching header value, or an empty optional when the header is absent.
◆ header() [2/2]
| std::optional< std::string_view > kaycxx::http::response_base::header |
( |
std::string_view | name | ) |
const & |
|
nodiscardnoexcept |
Returns the first value of a response header using an ASCII case-insensitive name comparison.
The returned view remains valid until this response is destroyed, moved from or assigned a new value.
- Parameters
-
- Returns
- First matching header value, or an empty optional when the header is absent.
◆ headers() [1/3]
Moves all response headers out of an expiring response.
- Returns
- Response headers.
◆ headers() [2/3]
Returns all response headers in their received order.
The returned reference remains valid until this response is destroyed, moved from or assigned a new value.
- Returns
- Response headers.
◆ headers() [3/3]
| std::vector< std::string > kaycxx::http::response_base::headers |
( |
std::string_view | name | ) |
const |
|
nodiscard |
Returns all values of a response header using an ASCII case-insensitive name comparison.
- Parameters
-
- Returns
- Matching header values in their received order.
◆ status_code()
| int kaycxx::http::response_base::status_code |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns the HTTP status code.
- Returns
- HTTP status code.
The documentation for this class was generated from the following file: