Module normalize_path

Module normalize_path 

Source
Expand description

Initializer to add a NormalizePathLayer middleware to handle a trailing / at the end of URIs.

See the layer’s docs for more details.

Note that the normal approach to adding middleware via Router::layer results in the middleware running after routing has already occurred. This means that any middleware that re-writes the request URI, including NormalizePathLayer, will not work as expected if added using Router::layer. As a workaround, the middleware can be added by wrapping the entire router. See axum’s docs for more details and an example.

Structs§

NormalizePathInitializer