pub struct SetResponseHeader<S, M> { /* private fields */ }
Expand description
Middleware that sets a header on the response.
Implementations§
Source§impl<S, M> SetResponseHeader<S, M>
impl<S, M> SetResponseHeader<S, M>
Sourcepub fn overriding(inner: S, header_name: HeaderName, make: M) -> Self
pub fn overriding(inner: S, header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeader
.
If a previous value exists for the same header, it is removed and replaced with the new header value.
Sourcepub fn appending(inner: S, header_name: HeaderName, make: M) -> Self
pub fn appending(inner: S, header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeader
.
The new header is always added, preserving any existing values. If previous values exist, the header will have multiple values.
Sourcepub fn if_not_present(inner: S, header_name: HeaderName, make: M) -> Self
pub fn if_not_present(inner: S, header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeader
.
If a previous value exists for the header, the new value is not inserted.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
Source§impl<S, F, A> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
impl<S, F, A> SetResponseHeader<S, BoxMakeHeaderValueFactoryFn<F, A>>
Sourcepub fn overriding_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
pub fn overriding_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::overriding
for more details.
Sourcepub fn appending_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
pub fn appending_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::appending
for more details.
Sourcepub fn if_not_present_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
pub fn if_not_present_fn(inner: S, header_name: HeaderName, make_fn: F) -> Self
Create a new SetResponseHeader
from a [super::MakeHeaderValueFn
].
See SetResponseHeader::if_not_present
for more details.
Trait Implementations§
Source§impl<S: Clone, M: Clone> Clone for SetResponseHeader<S, M>
impl<S: Clone, M: Clone> Clone for SetResponseHeader<S, M>
Source§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 moreSource§impl<S, M> Debug for SetResponseHeader<S, M>where
S: Debug,
impl<S, M> Debug for SetResponseHeader<S, M>where
S: Debug,
Source§impl<ReqBody, ResBody, State, S, M> Service<State, Request<ReqBody>> for SetResponseHeader<S, M>
impl<ReqBody, ResBody, State, S, M> Service<State, Request<ReqBody>> for SetResponseHeader<S, M>
Source§type Response = <S as Service<State, Request<ReqBody>>>::Response
type Response = <S as Service<State, Request<ReqBody>>>::Response
Source§type Error = <S as Service<State, Request<ReqBody>>>::Error
type Error = <S as Service<State, Request<ReqBody>>>::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§
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<S, State, Request, Connection> ConnectorService<State, Request> for S
impl<S, State, Request, Connection> ConnectorService<State, Request> for S
Source§type Connection = Connection
type Connection = Connection
ConnectorService
Source§type Error = <S as Service<State, Request>>::Error
type Error = <S as Service<State, Request>>::Error
Source§fn connect(
&self,
ctx: Context<State>,
req: Request,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>, <S as ConnectorService<State, Request>>::Error>> + Send
fn connect( &self, ctx: Context<State>, req: Request, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>, <S as ConnectorService<State, Request>>::Error>> + Send
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<State, S, Body> HttpClientExt<State> for S
impl<State, S, Body> HttpClientExt<State> for S
Source§type ExecuteResponse = Response<Body>
type ExecuteResponse = Response<Body>
execute
method.Source§type ExecuteError = <S as Service<State, Request<Body>>>::Error
type ExecuteError = <S as Service<State, Request<Body>>>::Error
execute
method.Source§fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
GET
request to a URL. Read moreSource§fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
POST
request to a URL. Read moreSource§fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
PUT
request to a URL. Read moreSource§fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
PATCH
request to a URL. Read moreSource§fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
DELETE
request to a URL. Read moreSource§fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
HEAD
request to a URL. Read moreSource§fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Source§fn execute(
&self,
ctx: Context<State>,
request: Request<Body>,
) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
fn execute( &self, ctx: Context<State>, request: Request<Body>, ) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
Request
. Read moreSource§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<State, S, R> IntoEndpointService<State, (State, R)> for Swhere
State: Clone + Send + Sync + 'static,
S: Service<State, Request<Body>, Response = R, Error = Infallible>,
R: IntoResponse + Send + Sync + 'static,
impl<State, S, R> IntoEndpointService<State, (State, R)> for Swhere
State: Clone + Send + Sync + 'static,
S: Service<State, Request<Body>, Response = R, Error = Infallible>,
R: IntoResponse + Send + Sync + 'static,
Source§fn into_endpoint_service(
self,
) -> impl Service<State, Request<Body>, Response = Response<Body>, Error = Infallible>
fn into_endpoint_service( self, ) -> impl Service<State, Request<Body>, Response = Response<Body>, Error = Infallible>
rama_core::Service
.