Skip to main content

normalize_url_path

Function normalize_url_path 

Source
pub fn normalize_url_path(
    url_path: &str,
    url_path_prefix: Option<&str>,
) -> String
Expand description

Normalize a URL path to one-leading-slash, no-trailing-slash form.

§Why we canonicalise here instead of at each call site

Rule-set authors write paths inconsistently — /api/v1, api/v1, /api/v1/ — and client requests arrive with similar variation. Choosing one canonical form at the boundary means every matcher downstream compares already-normalized strings, eliminating a class of “why isn’t my rule matching?” bugs.