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;
// Provided method
fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
A minimal interface necessary for sending requests over HTTP. Used primarily for exporting telemetry over HTTP. Also used for fetching sampling strategies for JaegerRemoteSampler
Users sometime choose HTTP clients that relay on a certain async runtime. This trait allows users to bring their choice of HTTP client.
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 HTTP response including the status code and body.
Returns an error if it can’t connect to the server or the request could not be completed, e.g. because of a timeout, infinite redirects, or a loss of connection.
Provided Methods§
Sourcefn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
👎Deprecated: Use send_bytes
with Bytes
payload instead.
fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
send_bytes
with Bytes
payload instead.Send the specified HTTP request with Vec<u8>
payload
Returns the HTTP response including the status code and body.
Returns an error if it can’t connect to the server or the request could not be completed, e.g. because of a timeout, infinite redirects, or a loss of connection.