pub trait HttpClient:
Debug
+ Send
+ Sync {
// Required method
fn send_bytes<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A minimal interface for sending byte-oriented HTTP requests.
This is primarily used for exporting telemetry and for fetching remote sampling strategies. Implementations are responsible for enforcing any required request timeout, including while reading the response body.
HTTP clients may depend on a particular async runtime. This trait allows users to supply an implementation suitable for their runtime.
Required Methods§
Sourcefn send_bytes<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_bytes<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send the specified HTTP request with Bytes payload.
Returns the complete HTTP response, including non-success status codes.
Returns an error if the request cannot be completed, for example because of a connection failure, timeout, redirect failure, or response body larger than 4 MiB in a built-in client.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".