pub enum RequestMatcher {
Path(String),
Method(Vec<String>),
Header {
name: String,
pattern: String,
},
HeaderRegex {
name: String,
regex: String,
},
Query {
key: String,
value: Option<String>,
},
RemoteIp(Vec<String>),
Protocol(String),
Expression(String),
Not(Box<RequestMatcher>),
And(Vec<RequestMatcher>),
Or(Vec<RequestMatcher>),
Language(Vec<String>),
}Expand description
A composable request matcher that can test various aspects of an incoming
HTTP request. Matchers can be combined with And, Or, and Not.
Variants§
Path(String)
Match the request path using glob-style patterns.
Method(Vec<String>)
Match the HTTP method (e.g. ["GET", "POST"]).
Header
Match a header value with glob pattern (e.g. name="X-Custom", pattern="foo*").
HeaderRegex
Match a header value with regex-like glob pattern.
Query
Match a query parameter. If value is None, just check presence.
RemoteIp(Vec<String>)
Match client IP against CIDR ranges (e.g. ["192.168.0.0/16", "10.0.0.0/8"]).
Protocol(String)
Match the protocol/scheme (e.g. "https", "http").
Expression(String)
Simple expression matcher: "{method} == GET && {path} ~ /api/*".
Not(Box<RequestMatcher>)
Logical NOT.
And(Vec<RequestMatcher>)
Logical AND: all must match.
Or(Vec<RequestMatcher>)
Logical OR: at least one must match.
Language(Vec<String>)
Match the Accept-Language header against a list of language tags. Uses case-insensitive prefix matching (e.g. “en” matches “en-US”).
Implementations§
Trait Implementations§
Source§impl Clone for RequestMatcher
impl Clone for RequestMatcher
Source§fn clone(&self) -> RequestMatcher
fn clone(&self) -> RequestMatcher
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more