pub fn normalize_method(raw: &str) -> Cow<'_, str>Expand description
Normalise an HTTP method name for use as a tracing span attribute.
Returns the input borrowed when it matches [A-Z]{1,16} exactly
(every standard method — GET, POST, PUT, PATCH, DELETE,
HEAD, OPTIONS, TRACE, CONNECT — passes through verbatim).
Anything else — lowercase (get), mixed case (Get), control
characters, non-ASCII, oversized padding — collapses to the
METHOD_OTHER_SENTINEL ("OTHER").
HTTP method names are far less risky than paths (hyper rejects most malformed values before they reach this layer) but we still normalise so that:
- dashboard label cardinality stays bounded (no per-request method variant exploding the metrics index),
- a custom client cannot smuggle non-standard bytes into the
methodspan field that the path sanitiser would have rejected.