pub trait ClientExt<B>: Client<B>{
// Provided methods
fn get(
&self,
url: &Url,
headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>,
) -> impl Future<Output = Result<Response<Incoming>, Error>>
where B: Default { ... }
fn post(
&self,
url: &Url,
headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>,
body: B,
) -> impl Future<Output = Result<Response<Incoming>, Error>> { ... }
}Expand description
Extension trait adding specific HTTP method functions (GET, POST, etc.) on top of the base
Client trait.
Provided Methods§
Sourcefn get(
&self,
url: &Url,
headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>,
) -> impl Future<Output = Result<Response<Incoming>, Error>>where
B: Default,
fn get(
&self,
url: &Url,
headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>,
) -> impl Future<Output = Result<Response<Incoming>, Error>>where
B: Default,
Sends an HTTP GET request to the connected server and returns the Response.
By definition, HTTP GET requests do not contain a body. Note that the Response body of
Incoming means the body must be collected separately from the Response status and
headers; this allows the status/headers to be checked before the full body has arrived.
Sourcefn post(
&self,
url: &Url,
headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>,
body: B,
) -> impl Future<Output = Result<Response<Incoming>, Error>>
fn post( &self, url: &Url, headers: impl IntoIterator<Item = (HeaderName, HeaderValue)>, body: B, ) -> impl Future<Output = Result<Response<Incoming>, Error>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".