Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient:
    Send
    + Sync
    + Debug {
    // Required method
    fn execute_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 Request,
    ) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

An HTTP client which can send requests.

Required Methods§

Source

fn execute_request<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 Request, ) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Send a request to the service.

It does not consume the request. Implementors are expected to clone the necessary parts of the request and pass them to the underlying transport.

§Errors

The built-in RetryPolicy will resend the Request for some ErrorKind::HttpResponse status codes e.g., StatusCode::TooManyRequests and for ErrorKind::Io returned by your HttpClient for situations like connection resets.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl HttpClient for Client

Source§

fn execute_request<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 Request, ) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Client: 'async_trait,

Implementors§