pub trait HttpClientExt: WasmCompatSend + WasmCompatSync {
// Required methods
fn send<T, U>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
where T: Into<Bytes> + WasmCompatSend,
U: From<Bytes> + WasmCompatSend + 'static;
fn send_multipart<U>(
&self,
req: Request<MultipartForm>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
where U: From<Bytes> + WasmCompatSend + 'static;
fn send_streaming<T>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn WasmCompatSendStream<Item = Result<Bytes, Error>, InnerItem = Result<Bytes, Error>>>>>, Error>> + WasmCompatSend
where T: Into<Bytes> + WasmCompatSend;
}Expand description
A helper trait to make generic requests (both regular and SSE) possible.
Required Methods§
Sourcefn send<T, U>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
fn send<T, U>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
Send a HTTP request, get a response back (as bytes). Response must be able to be turned back into Bytes.
Sourcefn send_multipart<U>(
&self,
req: Request<MultipartForm>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
fn send_multipart<U>( &self, req: Request<MultipartForm>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn Future<Output = Result<U, Error>> + Send>>>, Error>> + WasmCompatSend + 'static
Send a HTTP request with a multipart body, get a response back (as bytes). Response must be able to be turned back into Bytes (although usually for the response, you will probably want to specify Bytes anyway).
Sourcefn send_streaming<T>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<Pin<Box<dyn WasmCompatSendStream<Item = Result<Bytes, Error>, InnerItem = Result<Bytes, Error>>>>>, Error>> + WasmCompatSend
fn send_streaming<T>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<Pin<Box<dyn WasmCompatSendStream<Item = Result<Bytes, Error>, InnerItem = Result<Bytes, Error>>>>>, Error>> + WasmCompatSend
Send a HTTP request, get a streamed response back (as a stream of bytes::Bytes.)
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.
Implementations on Foreign Types§
Source§impl HttpClientExt for ClientWithMiddleware
Available on crate feature reqwest-middleware only.
impl HttpClientExt for ClientWithMiddleware
Available on crate feature
reqwest-middleware only.