pub struct DecompressionLayer<M = DefaultDecompressionMatcher> { /* private fields */ }compression only.Expand description
Decompresses response bodies of the underlying service.
This adds the Accept-Encoding header to requests and transparently decompresses response
bodies based on the Content-Encoding header.
See the module docs for more details.
Implementations§
Source§impl<M> DecompressionLayer<M>
impl<M> DecompressionLayer<M>
Sourcepub fn with_insert_accept_encoding_header(self, insert: bool) -> Self
pub fn with_insert_accept_encoding_header(self, insert: bool) -> Self
Sets whether the layer inserts Accept-Encoding into requests when it is absent.
By default it is true.
Sourcepub fn set_insert_accept_encoding_header(&mut self, insert: bool) -> &mut Self
pub fn set_insert_accept_encoding_header(&mut self, insert: bool) -> &mut Self
Sets whether the layer inserts Accept-Encoding into requests when it is absent.
By default it is true.
Sourcepub fn with_matcher<T>(self, matcher: T) -> DecompressionLayer<T>
pub fn with_matcher<T>(self, matcher: T) -> DecompressionLayer<T>
Replaces the request/response decompression matcher.
The default matcher DefaultDecompressionMatcher
matches any response which has a response payload to be decompressed.
Sourcepub fn with_tolerate_decode_errors(self, tolerate: bool) -> Self
pub fn with_tolerate_decode_errors(self, tolerate: bool) -> Self
End a response body cleanly on a mid-stream decode error (after some data decoded) instead of surfacing the error. Off by default.
Intended for relays that decode → modify → re-encode a response (e.g. a MITM HTML rewriter): a truncated upstream body then yields a short-but- well-formed client stream rather than an aborted one.
Sourcepub fn set_tolerate_decode_errors(&mut self, tolerate: bool) -> &mut Self
pub fn set_tolerate_decode_errors(&mut self, tolerate: bool) -> &mut Self
End a response body cleanly on a mid-stream decode error (after some data decoded) instead of surfacing the error. Off by default.
Intended for relays that decode → modify → re-encode a response (e.g. a MITM HTML rewriter): a truncated upstream body then yields a short-but- well-formed client stream rather than an aborted one.
Sourcepub fn set_gzip(&mut self, enable: bool) -> &mut Self
pub fn set_gzip(&mut self, enable: bool) -> &mut Self
Sets whether to request the gzip encoding.
Sourcepub fn with_deflate(self, enable: bool) -> Self
pub fn with_deflate(self, enable: bool) -> Self
Sets whether to request the Deflate encoding.
Sourcepub fn set_deflate(&mut self, enable: bool) -> &mut Self
pub fn set_deflate(&mut self, enable: bool) -> &mut Self
Sets whether to request the Deflate encoding.
Trait Implementations§
Source§impl<M: Clone> Clone for DecompressionLayer<M>
impl<M: Clone> Clone for DecompressionLayer<M>
Source§impl<M: Debug> Debug for DecompressionLayer<M>
impl<M: Debug> Debug for DecompressionLayer<M>
Source§impl<M: Default> Default for DecompressionLayer<M>
impl<M: Default> Default for DecompressionLayer<M>
Source§impl<S, M> Layer<S> for DecompressionLayer<M>where
M: Clone,
impl<S, M> Layer<S> for DecompressionLayer<M>where
M: Clone,
Source§type Service = Decompression<S, M>
type Service = Decompression<S, M>
Source§fn layer(&self, service: S) -> Self::Service
fn layer(&self, service: S) -> Self::Service
Source§fn into_layer(self, inner: S) -> Self::Service
fn into_layer(self, inner: S) -> Self::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl<M> Freeze for DecompressionLayer<M>where
M: Freeze,
impl<M> RefUnwindSafe for DecompressionLayer<M>where
M: RefUnwindSafe,
impl<M> Send for DecompressionLayer<M>where
M: Send,
impl<M> Sync for DecompressionLayer<M>where
M: Sync,
impl<M> Unpin for DecompressionLayer<M>where
M: Unpin,
impl<M> UnsafeUnpin for DecompressionLayer<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for DecompressionLayer<M>where
M: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer