pub trait HttpClientExt: HttpClient {
// Provided methods
fn get(
&self,
url: &str,
) -> impl Future<Output = Result<Response<Bytes>>> + Send { ... }
fn post_json<T: Serialize + Send + Sync>(
&self,
url: &str,
body: &T,
) -> impl Future<Output = Result<Response<Bytes>>> + Send { ... }
fn put_json<T: Serialize + Send + Sync>(
&self,
url: &str,
body: &T,
) -> impl Future<Output = Result<Response<Bytes>>> + Send { ... }
fn delete(
&self,
url: &str,
) -> impl Future<Output = Result<Response<Bytes>>> + Send { ... }
}Expand description
Extension trait for HttpClient with convenience methods.
Provided Methods§
Sourcefn post_json<T: Serialize + Send + Sync>(
&self,
url: &str,
body: &T,
) -> impl Future<Output = Result<Response<Bytes>>> + Send
fn post_json<T: Serialize + Send + Sync>( &self, url: &str, body: &T, ) -> impl Future<Output = Result<Response<Bytes>>> + Send
Execute a POST request with a JSON body.
§Errors
Returns an error if serialization or the request fails.
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.