ServiceExt

Trait ServiceExt 

Source
pub trait ServiceExt {
Show 26 methods // Provided methods fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self> where Self: Sized { ... } fn add_extension<T>(self, value: T) -> AddExtension<Self, T> where Self: Sized { ... } fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F> where Self: Sized { ... } fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F> where Self: Sized { ... } fn compression(self) -> Compression<Self> where Self: Sized { ... } fn decompression(self) -> Decompression<Self> where Self: Sized { ... } fn trace_for_http(self) -> Trace<Self, HttpMakeClassifier> where Self: Sized { ... } fn trace_for_grpc(self) -> Trace<Self, GrpcMakeClassifier> where Self: Sized { ... } fn follow_redirects(self) -> FollowRedirect<Self, Standard> where Self: Sized { ... } fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveHeaders<Self> where Self: Sized { ... } fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self> where Self: Sized { ... } fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self> where Self: Sized { ... } fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M> where Self: Sized { ... } fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M> where Self: Sized { ... } fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M> where Self: Sized { ... } fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M> where Self: Sized { ... } fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M> where Self: Sized { ... } fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M> where Self: Sized { ... } fn set_request_id<M>( self, header_name: HeaderName, make_request_id: M, ) -> SetRequestId<Self, M> where Self: Sized, M: MakeRequestId { ... } fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M> where Self: Sized, M: MakeRequestId { ... } fn propagate_request_id( self, header_name: HeaderName, ) -> PropagateRequestId<Self> where Self: Sized { ... } fn propagate_x_request_id(self) -> PropagateRequestId<Self> where Self: Sized { ... } fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic> where Self: Sized { ... } fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self> where Self: Sized { ... } fn trim_trailing_slash(self) -> NormalizePath<Self> where Self: Sized { ... } fn append_trailing_slash(self) -> NormalizePath<Self> where Self: Sized { ... }
}
Available on crate feature util only.
Expand description

Extension trait that adds methods to any Service for adding middleware from tower-http.

Provided Methods§

Source

fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>
where Self: Sized,

Available on crate feature propagate-header only.

Propagate a header from the request to the response.

See tower_http::propagate_header for more details.

Source

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Available on crate feature add-extension only.

Add some shareable value to request extensions.

See tower_http::add_extension for more details.

Source

fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>
where Self: Sized,

Available on crate feature map-request-body only.

Apply a transformation to the request body.

See tower_http::map_request_body for more details.

Source

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Available on crate feature map-response-body only.

Apply a transformation to the response body.

See tower_http::map_response_body for more details.

Source

fn compression(self) -> Compression<Self>
where Self: Sized,

Available on crate features compression-br or compression-deflate or compression-gzip or compression-zstd only.

Compresses response bodies.

See tower_http::compression for more details.

Source

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Available on crate features decompression-br or decompression-deflate or decompression-gzip or decompression-zstd only.

Decompress response bodies.

See tower_http::decompression for more details.

Source

fn trace_for_http(self) -> Trace<Self, HttpMakeClassifier>
where Self: Sized,

Available on crate feature trace only.

High level tracing that classifies responses using HTTP status codes.

This method does not support customizing the output, to do that use TraceLayer instead.

See tower_http::trace for more details.

Source

fn trace_for_grpc(self) -> Trace<Self, GrpcMakeClassifier>
where Self: Sized,

Available on crate feature trace only.

High level tracing that classifies responses using gRPC headers.

This method does not support customizing the output, to do that use TraceLayer instead.

See tower_http::trace for more details.

Source

fn follow_redirects(self) -> FollowRedirect<Self, Standard>
where Self: Sized,

Available on crate feature follow-redirect only.

Follow redirect resposes using the Standard policy.

See tower_http::follow_redirect for more details.

Source

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveHeaders<Self>
where Self: Sized,

Available on crate feature sensitive-headers only.

Mark headers as sensitive on both requests and responses.

See tower_http::sensitive_headers for more details.

Source

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Available on crate feature sensitive-headers only.

Mark headers as sensitive on requests.

See tower_http::sensitive_headers for more details.

Source

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Available on crate feature sensitive-headers only.

Mark headers as sensitive on responses.

See tower_http::sensitive_headers for more details.

Source

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Insert a header into the request.

If a previous value exists for the same header, it is removed and replaced with the new header value.

See tower_http::set_header for more details.

Source

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Append a header into the request.

If previous values exist, the header will have multiple values.

See tower_http::set_header for more details.

Source

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Insert a header into the request, if the header is not already present.

See tower_http::set_header for more details.

Source

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Insert a header into the response.

If a previous value exists for the same header, it is removed and replaced with the new header value.

See tower_http::set_header for more details.

Source

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Append a header into the response.

If previous values exist, the header will have multiple values.

See tower_http::set_header for more details.

Source

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.

Insert a header into the response, if the header is not already present.

See tower_http::set_header for more details.

Source

fn set_request_id<M>( self, header_name: HeaderName, make_request_id: M, ) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Available on crate feature request-id only.

Add request id header and extension.

See tower_http::request_id for more details.

Source

fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Available on crate feature request-id only.

Add request id header and extension, using x-request-id as the header name.

See tower_http::request_id for more details.

Source

fn propagate_request_id( self, header_name: HeaderName, ) -> PropagateRequestId<Self>
where Self: Sized,

Available on crate feature request-id only.

Propgate request ids from requests to responses.

See tower_http::request_id for more details.

Source

fn propagate_x_request_id(self) -> PropagateRequestId<Self>
where Self: Sized,

Available on crate feature request-id only.

Propgate request ids from requests to responses, using x-request-id as the header name.

See tower_http::request_id for more details.

Source

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Available on crate feature catch-panic only.

Catch panics and convert them into 500 Internal Server responses.

See tower_http::catch_panic for more details.

Source

fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>
where Self: Sized,

Available on crate feature limit only.

Intercept requests with over-sized payloads and convert them into 413 Payload Too Large responses.

See tower_http::limit for more details.

Source

fn trim_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Available on crate feature normalize-path only.

Remove trailing slashes from paths.

See tower_http::normalize_path for more details.

Source

fn append_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Available on crate feature normalize-path only.

Append trailing slash to paths.

See tower_http::normalize_path for more details.

Implementors§

Source§

impl<T> ServiceExt for T