Skip to main content

Interceptor

Trait Interceptor 

Source
pub trait Interceptor: Send + Sync {
    // Provided methods
    fn intercept_request<'life0, 'async_trait>(
        &'life0 self,
        request: MitmRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Option<MitmRequest>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn intercept_response<'life0, 'async_trait>(
        &'life0 self,
        response: MitmResponse,
    ) -> Pin<Box<dyn Future<Output = Result<Option<MitmResponse>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Unified trait for intercepting both requests and responses with automatic correlation This trait is recommended over separate RequestInterceptor and ResponseInterceptor as it provides automatic session correlation between requests and responses.

Provided Methods§

Source

fn intercept_request<'life0, 'async_trait>( &'life0 self, request: MitmRequest, ) -> Pin<Box<dyn Future<Output = Result<Option<MitmRequest>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Intercept and optionally modify a request

Return None to block the request, or return a modified request

Source

fn intercept_response<'life0, 'async_trait>( &'life0 self, response: MitmResponse, ) -> Pin<Box<dyn Future<Output = Result<Option<MitmResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Intercept and optionally modify a response The response is automatically correlated with its request via session_id

Return None to block the response, or return a modified response

Implementors§