fix: support regexp in path/pathprefix in matcher v2
This commit is contained in:
parent
b636b21167
commit
fc897f6756
2 changed files with 44 additions and 8 deletions
|
@ -454,6 +454,18 @@ func TestPathV2Matcher(t *testing.T) {
|
|||
"https://example.com/css/main.css": http.StatusNotFound,
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "valid Path matcher with regexp",
|
||||
rule: "Path(`/css{path:(/.*)?}`)",
|
||||
expected: map[string]int{
|
||||
"https://example.com": http.StatusNotFound,
|
||||
"https://example.com/css/main.css": http.StatusOK,
|
||||
"https://example.org/css/main.css": http.StatusOK,
|
||||
"https://example.com/css/components/component.css": http.StatusOK,
|
||||
"https://example.com/css.css": http.StatusNotFound,
|
||||
"https://example.com/js/main.js": http.StatusNotFound,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
@ -535,6 +547,18 @@ func TestPathPrefixV2Matcher(t *testing.T) {
|
|||
"https://example.com/css/main.css": http.StatusOK,
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "valid PathPrefix matcher with regexp",
|
||||
rule: "PathPrefix(`/css-{name:[0-9]?}`)",
|
||||
expected: map[string]int{
|
||||
"https://example.com": http.StatusNotFound,
|
||||
"https://example.com/css-1/main.css": http.StatusOK,
|
||||
"https://example.org/css-222/main.css": http.StatusOK,
|
||||
"https://example.com/css-333333/components/component.css": http.StatusOK,
|
||||
"https://example.com/css.css": http.StatusNotFound,
|
||||
"https://example.com/js/main.js": http.StatusNotFound,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue