pub trait HttpService:
Send
+ Sync
+ Debug {
// Required method
fn call<'a, 'async_trait>(
&'a self,
req: &'a (dyn Fn() -> Result<Request, AgentError> + Send + Sync),
max_retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Response, 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, AgentError> + Send + Sync),
max_retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Response, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn call<'a, 'async_trait>(
&'a self,
req: &'a (dyn Fn() -> Result<Request, AgentError> + Send + Sync),
max_retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Response, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Perform a HTTP request. Any retry logic should call req again, instead of Request::try_clone.