pub trait HttpClient: Send + Sync {
// Required methods
fn get<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn get_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Async HTTP client trait — abstracts over reqwest for testability.
Required Methods§
Sourcefn get<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Send a GET request with custom headers and return the text response.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".