pub struct RequestDecompression<S> { /* private fields */ }
Expand description
Decompresses request bodies and calls its underlying service.
Transparently decompresses request bodies based on the Content-Encoding
header.
When the encoding in the Content-Encoding
header is not accepted an Unsupported Media Type
status code will be returned with the accepted encodings in the Accept-Encoding
header.
Enabling pass-through of unaccepted encodings will not return an Unsupported Media Type
but
will call the underlying service with the unmodified request if the encoding is not supported.
This is disabled by default.
See the module docs for more details.
Implementations§
Source§impl<S> RequestDecompression<S>
impl<S> RequestDecompression<S>
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
Sourcepub fn layer() -> RequestDecompressionLayer
pub fn layer() -> RequestDecompressionLayer
Returns a new Layer
that wraps services with a RequestDecompression
middleware.
Sourcepub fn pass_through_unaccepted(self, enabled: bool) -> Self
pub fn pass_through_unaccepted(self, enabled: bool) -> Self
Passes through the request even when the encoding is not supported.
By default pass-through is disabled.
Sourcepub fn no_gzip(self) -> Self
pub fn no_gzip(self) -> Self
Disables support for gzip encoding.
This method is available even if the gzip
crate feature is disabled.
Sourcepub fn no_deflate(self) -> Self
pub fn no_deflate(self) -> Self
Disables support for Deflate encoding.
This method is available even if the deflate
crate feature is disabled.
Trait Implementations§
Source§impl<S: Clone> Clone for RequestDecompression<S>
impl<S: Clone> Clone for RequestDecompression<S>
Source§fn clone(&self) -> RequestDecompression<S>
fn clone(&self) -> RequestDecompression<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<S: Debug> Debug for RequestDecompression<S>
impl<S: Debug> Debug for RequestDecompression<S>
Source§impl<S, ReqBody, ResBody, D> Service<Request<ReqBody>> for RequestDecompression<S>
impl<S, ReqBody, ResBody, D> Service<Request<ReqBody>> for RequestDecompression<S>
Source§type Response = Response<UnsyncBoxBody<D, Box<dyn Error + Send + Sync>>>
type Response = Response<UnsyncBoxBody<D, Box<dyn Error + Send + Sync>>>
Source§type Error = <S as Service<Request<DecompressionBody<ReqBody>>>>::Error
type Error = <S as Service<Request<DecompressionBody<ReqBody>>>>::Error
Source§type Future = RequestDecompressionFuture<<S as Service<Request<DecompressionBody<ReqBody>>>>::Future, ResBody, <S as Service<Request<DecompressionBody<ReqBody>>>>::Error>
type Future = RequestDecompressionFuture<<S as Service<Request<DecompressionBody<ReqBody>>>>::Future, ResBody, <S as Service<Request<DecompressionBody<ReqBody>>>>::Error>
Auto Trait Implementations§
impl<S> Freeze for RequestDecompression<S>where
S: Freeze,
impl<S> RefUnwindSafe for RequestDecompression<S>where
S: RefUnwindSafe,
impl<S> Send for RequestDecompression<S>where
S: Send,
impl<S> Sync for RequestDecompression<S>where
S: Sync,
impl<S> Unpin for RequestDecompression<S>where
S: Unpin,
impl<S> UnwindSafe for RequestDecompression<S>where
S: UnwindSafe,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Service
, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready
method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready
method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready
method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read moreSource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
AsyncFilter
that conditionally accepts or
rejects requests based on an [async predicate]. Read more