pub trait HttpService:
Send
+ Sync
+ Debug {
// Required method
fn call<'a, 'async_trait>(
&'a self,
req: &'a (dyn Fn() -> Result<Request<Bytes>, AgentError> + Send + Sync),
max_retries: usize,
size_limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
}
Expand description
HTTP client middleware. Implemented automatically for reqwest
-compatible by-ref tower::Service
, such as reqwest_middleware
.
Required Methods§
Sourcefn call<'a, 'async_trait>(
&'a self,
req: &'a (dyn Fn() -> Result<Request<Bytes>, AgentError> + Send + Sync),
max_retries: usize,
size_limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn call<'a, 'async_trait>(
&'a self,
req: &'a (dyn Fn() -> Result<Request<Bytes>, AgentError> + Send + Sync),
max_retries: usize,
size_limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Perform a HTTP request. Any retry logic should call req
again to get a new request.