HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    // Required method
    fn execute(
        &self,
        request: Request<Bytes>,
    ) -> impl Future<Output = Result<Response<Bytes>>> + Send;
}
Expand description

Core HTTP client trait.

This trait defines the interface for executing HTTP requests. Implementations should be async-first and support connection pooling.

Required Methods§

Source

fn execute( &self, request: Request<Bytes>, ) -> impl Future<Output = Result<Response<Bytes>>> + Send

Execute an HTTP request and return the response.

§Errors

Returns an error if the request fails for any reason:

  • Network errors
  • TLS errors
  • Timeouts
  • Invalid response

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§