Abstract interface for HTTP client implementations. More...
#include <http_client.h>

Public Member Functions | |
| virtual | ~IHttpClient ()=default |
| virtual absl::StatusOr< HttpResponse > | Get (const std::string &url, const Headers &headers={})=0 |
| Perform an HTTP GET request. | |
| virtual absl::StatusOr< HttpResponse > | Post (const std::string &url, const std::string &body, const Headers &headers={})=0 |
| Perform an HTTP POST request. | |
| virtual absl::StatusOr< HttpResponse > | Put (const std::string &url, const std::string &body, const Headers &headers={}) |
| Perform an HTTP PUT request. | |
| virtual absl::StatusOr< HttpResponse > | Delete (const std::string &url, const Headers &headers={}) |
| Perform an HTTP DELETE request. | |
| virtual void | SetTimeout (int timeout_seconds) |
| Set a timeout for HTTP requests. | |
| int | GetTimeout () const |
| Get the current timeout setting. | |
Protected Attributes | |
| int | timeout_seconds_ = 30 |
Abstract interface for HTTP client implementations.
This interface abstracts HTTP operations to support both native (using cpp-httplib) and WASM (using emscripten fetch) implementations. All methods return absl::Status or absl::StatusOr for consistent error handling.
Definition at line 48 of file http_client.h.
|
virtualdefault |
|
pure virtual |
Perform an HTTP GET request.
| url | The URL to request |
| headers | Optional HTTP headers |
Implemented in yaze::net::HttpLibClient.
|
pure virtual |
Perform an HTTP POST request.
| url | The URL to post to |
| body | The request body |
| headers | Optional HTTP headers |
Implemented in yaze::net::HttpLibClient.
|
inlinevirtual |
Perform an HTTP PUT request.
| url | The URL to put to |
| body | The request body |
| headers | Optional HTTP headers |
Reimplemented in yaze::net::HttpLibClient.
Definition at line 81 of file http_client.h.
|
inlinevirtual |
Perform an HTTP DELETE request.
| url | The URL to delete |
| headers | Optional HTTP headers |
Reimplemented in yaze::net::HttpLibClient.
Definition at line 95 of file http_client.h.
|
inlinevirtual |
Set a timeout for HTTP requests.
| timeout_seconds | Timeout in seconds |
Reimplemented in yaze::net::HttpLibClient.
Definition at line 106 of file http_client.h.
References timeout_seconds_.
Referenced by yaze::net::HttpLibClient::SetTimeout().
|
inline |
Get the current timeout setting.
Definition at line 114 of file http_client.h.
References timeout_seconds_.
|
protected |
Definition at line 117 of file http_client.h.
Referenced by yaze::net::HttpLibClient::GetOrCreateClient(), GetTimeout(), and SetTimeout().