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

Public Member Functions | |
| http_request ()=default | |
| http_request (std::string url_) | |
| http_request (std::string url_, std::string method_) | |
| http_request (std::string url_, std::string method_, http_headers headers_) | |
| http_request (std::string url_, std::string method_, http_headers headers_, std::vector< uint8_t > body_) | |
| http_request & | set_content_type (const std::string &content_type) |
| Set Content-Type header. | |
| http_request & | set_authorization (const std::string &auth) |
| Set Authorization header. | |
| http_request & | set_body (const std::string &str) |
| Set body from string. | |
Public Attributes | |
| std::string | url |
| Request URL (must include scheme, e.g., "https://api.example.com/v1/data") | |
| std::string | method = "GET" |
| HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS) | |
| http_headers | headers |
| Request headers. | |
| std::vector< uint8_t > | body |
| Request body (for POST, PUT, PATCH) | |
| std::chrono::milliseconds | timeout {30000} |
| Request timeout (default: 30 seconds) | |
| bool | follow_redirects = true |
| Whether to follow redirects (default: true) | |
| int | max_redirects = 5 |
| Maximum number of redirects to follow (default: 5) | |
Represents an HTTP request.
Definition at line 37 of file http_client_interface.h.
|
default |
|
inlineexplicit |
Definition at line 63 of file http_client_interface.h.
|
inline |
Definition at line 66 of file http_client_interface.h.
|
inline |
Definition at line 69 of file http_client_interface.h.
|
inline |
Definition at line 74 of file http_client_interface.h.
|
inline |
Set Authorization header.
| auth | Authorization value (e.g., "Bearer token123") |
Definition at line 98 of file http_client_interface.h.
References headers.
|
inline |
Set body from string.
| str | String body content |
Definition at line 108 of file http_client_interface.h.
References body.
|
inline |
Set Content-Type header.
| content_type | MIME type string |
Definition at line 88 of file http_client_interface.h.
References headers.
| std::vector<uint8_t> kcenon::common::interfaces::http_request::body |
Request body (for POST, PUT, PATCH)
Definition at line 48 of file http_client_interface.h.
Referenced by set_body().
| bool kcenon::common::interfaces::http_request::follow_redirects = true |
Whether to follow redirects (default: true)
Definition at line 54 of file http_client_interface.h.
| http_headers kcenon::common::interfaces::http_request::headers |
Request headers.
Definition at line 45 of file http_client_interface.h.
Referenced by set_authorization(), and set_content_type().
| int kcenon::common::interfaces::http_request::max_redirects = 5 |
Maximum number of redirects to follow (default: 5)
Definition at line 57 of file http_client_interface.h.
| std::string kcenon::common::interfaces::http_request::method = "GET" |
HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
Definition at line 42 of file http_client_interface.h.
| std::chrono::milliseconds kcenon::common::interfaces::http_request::timeout {30000} |
Request timeout (default: 30 seconds)
Definition at line 51 of file http_client_interface.h.
| std::string kcenon::common::interfaces::http_request::url |
Request URL (must include scheme, e.g., "https://api.example.com/v1/data")
Definition at line 39 of file http_client_interface.h.