Skip to main content

UpstreamResponse

Trait UpstreamResponse 

Source
pub trait UpstreamResponse<ResponseBodyT> {
    // Required methods
    fn should_skip_cache<RequestBodyT, CacheT, CacheKeyT>(
        &self,
        uri: &Uri,
        configuration: &MiddlewareCachingConfiguration<CacheT, CacheKeyT, RequestBodyT>,
    ) -> (bool, Option<usize>);
    fn validate_encoding(
        &self,
        uri: &Uri,
        encoding: Encoding,
        content_length: Option<usize>,
        configuration: &MiddlewareEncodingConfiguration,
    ) -> (Encoding, bool);
}
Expand description

Upstream response.

Required Methods§

Source

fn should_skip_cache<RequestBodyT, CacheT, CacheKeyT>( &self, uri: &Uri, configuration: &MiddlewareCachingConfiguration<CacheT, CacheKeyT, RequestBodyT>, ) -> (bool, Option<usize>)

Check if we should skip the cache.

Also returns the value of Content-Length if available.

If the response passes all our checks then we turn to the hook to give it one last chance to skip the cache.

Source

fn validate_encoding( &self, uri: &Uri, encoding: Encoding, content_length: Option<usize>, configuration: &MiddlewareEncodingConfiguration, ) -> (Encoding, bool)

Validate encoding.

Checks content_length, if provided, against min_body_size. And gives the hook one last chance to skip encoding.

Will return true if we are forcing a skip.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<ResponseBodyT> UpstreamResponse<ResponseBodyT> for Response<ResponseBodyT>

Source§

fn should_skip_cache<RequestBodyT, CacheT, CacheKeyT>( &self, uri: &Uri, configuration: &MiddlewareCachingConfiguration<CacheT, CacheKeyT, RequestBodyT>, ) -> (bool, Option<usize>)

Source§

fn validate_encoding( &self, uri: &Uri, encoding: Encoding, content_length: Option<usize>, configuration: &MiddlewareEncodingConfiguration, ) -> (Encoding, bool)

Implementors§