|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Represents an HTTP response. More...
#include <http_client_interface.h>

Public Member Functions | |
| bool | is_success () const |
| Check if response indicates success (2xx status) | |
| bool | is_client_error () const |
| Check if response indicates client error (4xx status) | |
| bool | is_server_error () const |
| Check if response indicates server error (5xx status) | |
| std::string | body_as_string () const |
| Get body as string. | |
| std::optional< std::string > | get_header (const std::string &name) const |
| Get a specific header value. | |
Public Attributes | |
| int | status_code = 0 |
| HTTP status code (e.g., 200, 404, 500) | |
| std::string | reason_phrase |
| Status reason phrase (e.g., "OK", "Not Found") | |
| http_headers | headers |
| Response headers. | |
| std::vector< uint8_t > | body |
| Response body. | |
| std::chrono::milliseconds | elapsed {0} |
| Time taken to receive the response. | |
| std::optional< std::string > | final_url |
| Final URL after redirects (may differ from request URL) | |
Represents an HTTP response.
Definition at line 118 of file http_client_interface.h.
|
inlinenodiscard |
Get body as string.
Definition at line 167 of file http_client_interface.h.
References body.
|
inlinenodiscard |
Get a specific header value.
| name | Header name (case-insensitive matching recommended by caller) |
Definition at line 176 of file http_client_interface.h.
References headers.
|
inlinenodiscard |
Check if response indicates client error (4xx status)
Definition at line 151 of file http_client_interface.h.
References status_code.
|
inlinenodiscard |
Check if response indicates server error (5xx status)
Definition at line 159 of file http_client_interface.h.
References status_code.
|
inlinenodiscard |
Check if response indicates success (2xx status)
Definition at line 143 of file http_client_interface.h.
References status_code.
| std::vector<uint8_t> kcenon::common::interfaces::http_response::body |
Response body.
Definition at line 129 of file http_client_interface.h.
Referenced by body_as_string().
| std::chrono::milliseconds kcenon::common::interfaces::http_response::elapsed {0} |
| std::optional<std::string> kcenon::common::interfaces::http_response::final_url |
Final URL after redirects (may differ from request URL)
Definition at line 135 of file http_client_interface.h.
| http_headers kcenon::common::interfaces::http_response::headers |
Response headers.
Definition at line 126 of file http_client_interface.h.
Referenced by get_header().
| std::string kcenon::common::interfaces::http_response::reason_phrase |
Status reason phrase (e.g., "OK", "Not Found")
Definition at line 123 of file http_client_interface.h.
| int kcenon::common::interfaces::http_response::status_code = 0 |
HTTP status code (e.g., 200, 404, 500)
Definition at line 120 of file http_client_interface.h.
Referenced by is_client_error(), is_server_error(), and is_success().