Struct tower_http::set_header::request::SetRequestHeader
source · pub struct SetRequestHeader<S, M> { /* private fields */ }
Available on crate feature
set-header
only.Expand description
Middleware that sets a header on the request.
Implementations§
source§impl<S, M> SetRequestHeader<S, M>
impl<S, M> SetRequestHeader<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 SetRequestHeader
.
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 SetRequestHeader
.
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 SetRequestHeader
.
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.
Trait Implementations§
source§impl<S: Clone, M: Clone> Clone for SetRequestHeader<S, M>
impl<S: Clone, M: Clone> Clone for SetRequestHeader<S, M>
source§fn clone(&self) -> SetRequestHeader<S, M>
fn clone(&self) -> SetRequestHeader<S, M>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<S, M> Debug for SetRequestHeader<S, M>where
S: Debug,
impl<S, M> Debug for SetRequestHeader<S, M>where
S: Debug,
source§impl<ReqBody, ResBody, S, M> Service<Request<ReqBody>> for SetRequestHeader<S, M>where
S: Service<Request<ReqBody>, Response = Response<ResBody>>,
M: MakeHeaderValue<Request<ReqBody>>,
impl<ReqBody, ResBody, S, M> Service<Request<ReqBody>> for SetRequestHeader<S, M>where
S: Service<Request<ReqBody>, Response = Response<ResBody>>,
M: MakeHeaderValue<Request<ReqBody>>,
Auto Trait Implementations§
impl<S, M> RefUnwindSafe for SetRequestHeader<S, M>where
M: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, M> Send for SetRequestHeader<S, M>
impl<S, M> Sync for SetRequestHeader<S, M>
impl<S, M> Unpin for SetRequestHeader<S, M>
impl<S, M> UnwindSafe for SetRequestHeader<S, M>where
M: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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,
Yields a mutable reference to the service when it is ready to accept a request.
source§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
👎Deprecated since 0.4.6: please use the
ServiceExt::ready
method insteadYields a mutable reference to the service when it is ready to accept a request.
source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Yields the service when it is ready to accept a request.
source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Consume this
Service
, calling with the providing 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>
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
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>
Maps this service’s response value to a different value. This does not
alter the behaviour of the
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>
Maps this service’s error value to a different value. This does not
alter the behaviour of the
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>
Maps this service’s result type (
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>
Composes a function in front of the service. Read more
source§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Composes an asynchronous function after this service. Read more
source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Composes a function that transforms futures produced by the service. Read more