rama::http::layer::remove_header

Module response

Expand description

Remove headers from a response.

§Example

use rama_http::layer::remove_header::RemoveResponseHeaderLayer;
use rama_http::{Body, Request, Response, header::{self, HeaderValue}};
use rama_core::service::service_fn;
use rama_core::{Context, Service, Layer};
use rama_core::error::BoxError;

let mut svc = (
    // Layer that removes all response headers with the prefix `x-foo`.
    RemoveResponseHeaderLayer::prefix("x-foo"),
).layer(http_client);

let request = Request::new(Body::empty());

let response = svc.serve(Context::default(), request).await?;

Structs§