normalize_binding

Function normalize_binding 

Source
pub fn normalize_binding(method: &str, path: &str) -> Result<String, AshError>
Expand description

Normalize a binding string to canonical form.

Bindings are in the format: METHOD /path

§Normalization Rules

  • Method is uppercased
  • Path must start with /
  • Query string is excluded
  • Duplicate slashes are collapsed
  • Trailing slash is removed (except for root /)

§Example

use ash_core::normalize_binding;

let binding = normalize_binding("post", "/api//users/").unwrap();
assert_eq!(binding, "POST /api/users");