pub trait Interceptor:
Send
+ Sync
+ Debug {
// Provided methods
fn on_request<'life0, 'async_trait>(
&'life0 self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<Request, SdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
_response: &'life1 Response,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Hook invoked around every outgoing HTTP request.
Provided Methods§
Sourcefn on_request<'life0, 'async_trait>(
&'life0 self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<Request, SdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_request<'life0, 'async_trait>(
&'life0 self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<Request, SdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Called just before the request is dispatched. Implementations may mutate the
request (add headers, extend the URL) by returning a modified Request.
Sourcefn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
_response: &'life1 Response,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_response<'life0, 'life1, 'async_trait>(
&'life0 self,
_response: &'life1 Response,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called after the transport layer produced a response. Implementations are free to observe the response; transforming it is not supported here on purpose — retry/decode semantics belong to the core, not to arbitrary interceptors.