Struct SetResponseHeader
pub struct SetResponseHeader<S, M> { /* private fields */ }
Expand description
Middleware that sets a header on the response.
Implementations§
§impl<S, M> SetResponseHeader<S, M>
impl<S, M> SetResponseHeader<S, M>
pub fn overriding(
inner: S,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<S, M>
pub fn overriding( inner: S, header_name: HeaderName, make: M, ) -> SetResponseHeader<S, M>
Create a new SetResponseHeader
.
If a previous value exists for the same header, it is removed and replaced with the new header value.
pub fn appending(
inner: S,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<S, M>
pub fn appending( inner: S, header_name: HeaderName, make: M, ) -> SetResponseHeader<S, M>
Create a new SetResponseHeader
.
The new header is always added, preserving any existing values. If previous values exist, the header will have multiple values.
pub fn if_not_present(
inner: S,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<S, M>
pub fn if_not_present( inner: S, header_name: HeaderName, make: M, ) -> SetResponseHeader<S, M>
Create a new SetResponseHeader
.
If a previous value exists for the header, the new value is not inserted.
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
§impl<S, F, A> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
impl<S, F, A> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
pub fn overriding_fn(
inner: S,
header_name: HeaderName,
make_fn: F,
) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
pub fn overriding_fn( inner: S, header_name: HeaderName, make_fn: F, ) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::overriding
for more details.
pub fn appending_fn(
inner: S,
header_name: HeaderName,
make_fn: F,
) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
pub fn appending_fn( inner: S, header_name: HeaderName, make_fn: F, ) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::appending
for more details.
pub fn if_not_present_fn(
inner: S,
header_name: HeaderName,
make_fn: F,
) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
pub fn if_not_present_fn( inner: S, header_name: HeaderName, make_fn: F, ) -> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::if_not_present
for more details.
Trait Implementations§
§impl<S, M> Clone for SetResponseHeader<S, M>
impl<S, M> Clone for SetResponseHeader<S, M>
§fn clone(&self) -> SetResponseHeader<S, M>
fn clone(&self) -> SetResponseHeader<S, M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<S, M> Debug for SetResponseHeader<S, M>where
S: Debug,
impl<S, M> Debug for SetResponseHeader<S, M>where
S: Debug,
§impl<ReqBody, ResBody, S, M> Service<Request<ReqBody>> for SetResponseHeader<S, M>
impl<ReqBody, ResBody, S, M> Service<Request<ReqBody>> for SetResponseHeader<S, M>
§type Response = <S as Service<Request<ReqBody>>>::Response
type Response = <S as Service<Request<ReqBody>>>::Response
§async fn serve(
&self,
ctx: Context,
req: Request<ReqBody>,
) -> Result<<SetResponseHeader<S, M> as Service<Request<ReqBody>>>::Response, <SetResponseHeader<S, M> as Service<Request<ReqBody>>>::Error>
async fn serve( &self, ctx: Context, req: Request<ReqBody>, ) -> Result<<SetResponseHeader<S, M> as Service<Request<ReqBody>>>::Response, <SetResponseHeader<S, M> as Service<Request<ReqBody>>>::Error>
§fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
Auto Trait Implementations§
impl<S, M> !Freeze for SetResponseHeader<S, M>
impl<S, M> RefUnwindSafe for SetResponseHeader<S, M>where
S: RefUnwindSafe,
M: RefUnwindSafe,
impl<S, M> Send for SetResponseHeader<S, M>
impl<S, M> Sync for SetResponseHeader<S, M>
impl<S, M> Unpin for SetResponseHeader<S, M>
impl<S, M> UnwindSafe for SetResponseHeader<S, M>where
S: UnwindSafe,
M: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S, Request, Connection> ConnectorService<Request> for S
impl<S, Request, Connection> ConnectorService<Request> for S
§type Connection = Connection
type Connection = Connection
ConnectorService
§fn connect(
&self,
ctx: Context,
req: Request,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>, <S as ConnectorService<Request>>::Error>> + Send
fn connect( &self, ctx: Context, req: Request, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Request>>::Connection, Request>, <S as ConnectorService<Request>>::Error>> + Send
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<S, Body> HttpClientExt for S
impl<S, Body> HttpClientExt for S
§type ExecuteResponse = Response<Body>
type ExecuteResponse = Response<Body>
execute
method.§type ExecuteError = <S as Service<Request<Body>>>::Error
type ExecuteError = <S as Service<Request<Body>>>::Error
execute
method.§fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
GET
request to a URL. Read more§fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
POST
request to a URL. Read more§fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
PUT
request to a URL. Read more§fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
PATCH
request to a URL. Read more§fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
DELETE
request to a URL. Read more§fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
HEAD
request to a URL. Read more§fn connect(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn connect( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
CONNECT
request to a URL. Read more§fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
§fn build_from_request<RequestBody>(
&self,
request: Request<RequestBody>,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn build_from_request<RequestBody>( &self, request: Request<RequestBody>, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
§fn execute(
&self,
ctx: Context,
request: Request<Body>,
) -> impl Future<Output = Result<<S as HttpClientExt>::ExecuteResponse, <S as HttpClientExt>::ExecuteError>>
fn execute( &self, ctx: Context, request: Request<Body>, ) -> impl Future<Output = Result<<S as HttpClientExt>::ExecuteResponse, <S as HttpClientExt>::ExecuteError>>
Request
. Read more§impl<S, Body> HttpClientWebSocketExt<Body> for S
impl<S, Body> HttpClientWebSocketExt<Body> for S
§fn websocket(
&self,
url: impl IntoUrl,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder
] to be used to establish a WebSocket connection over http/1.1.§fn websocket_h2(
&self,
url: impl IntoUrl,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket_h2( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder
to be used to establish a WebSocket connection over h2.§fn websocket_with_request<RequestBody>(
&self,
req: Request<RequestBody>,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket_with_request<RequestBody>( &self, req: Request<RequestBody>, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder
starting from the given request. Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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 more§impl<S, R> IntoEndpointService<(R,)> for Swhere
S: Service<Request<Body>, Response = R, Error = Infallible>,
R: IntoResponse + Send + Sync + 'static,
impl<S, R> IntoEndpointService<(R,)> for Swhere
S: Service<Request<Body>, Response = R, Error = Infallible>,
R: IntoResponse + Send + Sync + 'static,
§fn into_endpoint_service(
self,
) -> impl Service<Request<Body>, Response = Response<Body>, Error = Infallible>
fn into_endpoint_service( self, ) -> impl Service<Request<Body>, Response = Response<Body>, Error = Infallible>
rama_core::Service
.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more