pub trait HttpClient: Send + Default {
type Error;
// Required methods
fn get(
&self,
url: String,
headers: &Headers,
payload: &Query,
) -> impl Future<Output = Result<String, Self::Error>> + Send;
fn post(
&self,
url: String,
headers: &Headers,
payload: &Query,
) -> impl Future<Output = Result<String, Self::Error>> + Send;
}Expand description
A trait that can be implemented for any HTTP client library in Rust so we can use any library easily.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl HttpClient for ReqwestClient
Implements all functions of HttpClient for reqwest
impl HttpClient for ReqwestClient
Implements all functions of HttpClient for reqwest
type Error = ReqwestError
Source§impl HttpClient for TestClient
Implements a test HTTP client
Should just log request data at debug level
impl HttpClient for TestClient
Implements a test HTTP client Should just log request data at debug level