Trait http_client::HttpClient [−][src]
pub trait HttpClient: Debug + Unpin + Send + Sync + 'static { #[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; fn set_config(&mut self, _config: Config) -> Result<()> { ... } fn config(&self) -> &Config { ... } }
Expand description
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
Provided methods
Implementations on Foreign Types
impl HttpClient for Box<dyn HttpClient>
[src]
impl HttpClient for Box<dyn HttpClient>
[src]Implementors
impl HttpClient for H1Client
[src]
impl HttpClient for H1Client
[src]h1_client
and default
only.fn set_config(&mut self, config: Config) -> Result<()>
[src]
fn set_config(&mut self, config: Config) -> Result<()>
[src]Override the existing configuration with new configuration.
Config options may not impact existing connections.
impl HttpClient for HyperClient
[src]
impl HttpClient for HyperClient
[src]hyper_client
only.fn set_config(&mut self, config: Config) -> Result<()>
[src]
fn set_config(&mut self, config: Config) -> Result<()>
[src]Override the existing configuration with new configuration.
Config options may not impact existing connections.
impl HttpClient for IsahcClient
[src]
impl HttpClient for IsahcClient
[src]curl_client
only.fn set_config(&mut self, config: Config) -> Result<()>
[src]
fn set_config(&mut self, config: Config) -> Result<()>
[src]Override the existing configuration with new configuration.
Config options may not impact existing connections.