Expand description
Middleware that normalizes paths.
§Example
use tower_http::normalize_path::NormalizePathLayer;
use http::{Request, Response, StatusCode};
use http_body_util::Full;
use bytes::Bytes;
use std::{iter::once, convert::Infallible};
use tower::{ServiceBuilder, Service, ServiceExt};
async fn handle(req: Request<Full<Bytes>>) -> Result<Response<Full<Bytes>>, Infallible> {
    // `req.uri().path()` will not have trailing slashes
}
let mut service = ServiceBuilder::new()
    // trim trailing slashes from paths
    .layer(NormalizePathLayer::trim_trailing_slash())
    .service_fn(handle);
// call the service
let request = Request::builder()
    // `handle` will see `/foo`
    .uri("/foo/")
    .body(Full::default())?;
service.ready().await?.call(request).await?;Structs§
- NormalizePath 
- Middleware that normalizes paths.
- NormalizePath Layer 
- Layer that applies NormalizePathwhich normalizes paths.