[−][src]Trait http_client::HttpClient
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 we pass an HttpClient instance through the middleware,
with a Clone implementation. In order to spawn a new request, clone is called, and a new
request is enabled.
How Clone is implemented is up to the implementors, but in an ideal scenario combining this
with the Client builder will allow for high connection reuse, improving latency.
Associated Types
Loading content...Required methods
fn send(
&self,
req: Request
) -> BoxFuture<'static, Result<Response, Self::Error>>
&self,
req: Request
) -> BoxFuture<'static, Result<Response, Self::Error>>
Perform a request.