Trait http_client::HttpClient [−][src]
An abstract HTTP client.
note that this is only exposed for use in middleware. Building new backing clients is not
recommended yet. Once it is we’ll likely publish a new http_client
crate, and re-export this
trait from there together with all existing HTTP client implementations.
Spawning new request from middleware
When threading the trait through a layer of middleware, the middleware must be able to perform
new requests. In order to enable this efficiently an HttpClient
instance may want to be passed
though middleware for one of its own requests, and in order to do so should be wrapped in an
Rc
/Arc
to enable reference cloning.
Required methods
#[must_use]fn send<'life0, 'async_trait>(
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Perform a request.
Implementations on Foreign Types
impl HttpClient for Box<dyn HttpClient>
[src]
fn send<'life0, 'async_trait>(
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Implementors
impl HttpClient for H1Client
[src]
This is supported on
h1_client
and default
only.fn send<'life0, 'async_trait>(
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl HttpClient for HyperClient
[src]
This is supported on
hyper_client
only.fn send<'life0, 'async_trait>(
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl HttpClient for IsahcClient
[src]
This is supported on
curl_client
only.