Skip to main content

matches_route

Function matches_route 

Source
pub fn matches_route(
    rule: &MatchRule,
    path: &str,
    method: &str,
    headers: &[(String, String)],
    host: &str,
) -> bool
Expand description

Matches an incoming request against a route’s match rule.

All criteria present in the rule must match (logical AND); absent criteria match anything. Semantics per criterion:

  • path — exact match, trailing /* prefix wildcard, or * path segment wildcards (see match_path);
  • methods — case-insensitive; an empty list matches any method;
  • headers — every required key must be present with an exactly equal value (header names compared case-insensitively, values exactly);
  • host — case-insensitive equality.