fix(routing): fix wildcard host suffix matching and PathRegexp error message
- Fix Host(".example.com") incorrectly matching bare "example.com" by
using HasSuffix(reqHost, host) instead of HasSuffix(reqHost, host[1:])
- Fix PathRegexp matcher error message saying "PathPrefix" instead of
"PathRegexp"
- Add doc comments to NewMatcher and Tree types
- Add 28 unit tests covering all matcher types, boolean operators,
edge cases, and parameter validation
This commit is contained in:
@@ -14,12 +14,15 @@ const (
|
||||
or = "or"
|
||||
)
|
||||
|
||||
// Parser is an alias for the predicate parser used to parse routing rules.
|
||||
type Parser = predicate.Parser
|
||||
|
||||
// TreeBuilder defines the type for a Tree builder.
|
||||
type TreeBuilder func() *Tree
|
||||
|
||||
// Tree represents the rules' tree structure.
|
||||
// Tree represents the rules' tree structure used for routing matchers.
|
||||
// Leaf nodes hold a Matcher name, optional negation, and string values.
|
||||
// Internal nodes hold an "and"/"or" operator with left and right children.
|
||||
type Tree struct {
|
||||
Matcher string
|
||||
Not bool
|
||||
|
||||
Reference in New Issue
Block a user