Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    // Required method
    fn send<'life0, 'async_trait>(
        &'life0 self,
        builder: RequestBuilder,
    ) -> Pin<Box<dyn Future<Output = EveryMapResult<Response>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for HTTP clients, allowing dependency injection and testing.

Custom implementations can be used for testing (mock clients), retry logic, or custom transport configuration (timeouts, proxies).

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, builder: RequestBuilder, ) -> Pin<Box<dyn Future<Output = EveryMapResult<Response>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send an HTTP request and return the response.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§