Struct tower_http::set_header::response::SetResponseHeaderLayer
source · pub struct SetResponseHeaderLayer<M> { /* private fields */ }
Available on crate feature
set-header
only.Expand description
Layer that applies SetResponseHeader
which adds a response header.
See SetResponseHeader
for more details.
Implementations§
source§impl<M> SetResponseHeaderLayer<M>
impl<M> SetResponseHeaderLayer<M>
sourcepub fn overriding(header_name: HeaderName, make: M) -> Self
pub fn overriding(header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeaderLayer
.
If a previous value exists for the same header, it is removed and replaced with the new header value.
sourcepub fn appending(header_name: HeaderName, make: M) -> Self
pub fn appending(header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeaderLayer
.
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(header_name: HeaderName, make: M) -> Self
pub fn if_not_present(header_name: HeaderName, make: M) -> Self
Create a new SetResponseHeaderLayer
.
If a previous value exists for the header, the new value is not inserted.