pub trait HttpClient: Send + Sync {
// Required method
fn send(
&self,
request: ClientRequest,
) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send;
// Provided methods
fn get(
&self,
url: impl Into<String> + Send,
) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send { ... }
fn post(
&self,
url: impl Into<String> + Send,
body: impl Into<Vec<u8>> + Send,
) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send { ... }
}Expand description
Outbound HTTP client (Symfony HttpClientInterface analogue).
Required Methods§
Sourcefn send(
&self,
request: ClientRequest,
) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send
fn send( &self, request: ClientRequest, ) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send
Sends request and returns the response.
§Errors
Returns HttpClientError on transport or construction failure.
Provided Methods§
Sourcefn get(
&self,
url: impl Into<String> + Send,
) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send
fn get( &self, url: impl Into<String> + Send, ) -> impl Future<Output = Result<ClientResponse, HttpClientError>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".