Trait azure_core::HttpClient
source · [−]pub trait HttpClient: Send + Sync + Debug {
fn execute_request<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn execute_request2<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn execute_request_check_status<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
_expected_status: StatusCode
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
An HTTP client which can send requests.
Required Methods
Send out a request using hyperium/http
’s types.
This method is considered deprecated and should not be used in new code.
Send out a request using azure_core
’s types.
This function will be the only one remaining in the trait as soon as the trait stabilizes.
It will be renamed to execute_request
. The other helper functions (ie
execute_request_check_status
) will be removed since the status check will be
responsibility of another policy (not the transport one). It does not consume the request.
Implementors are expected to clone the necessary parts of the request and pass them to the
underlying transport.
Provided Methods
Send out a request and validate it was in the 2xx
range, using
hyperium/http
’s types.
Note: the expected_status
parameter is never used, and instead we
always validate the status was in the 2xx
range. This method should
be considered deprecated, and should not be used in new code.