fix tsr with mixed static and wildcard paths (#2924)
This commit is contained in:
+25
-2
@@ -587,7 +587,14 @@ func TestTreeTrailingSlashRedirect(t *testing.T) {
|
||||
"/doc/go1.html",
|
||||
"/no/a",
|
||||
"/no/b",
|
||||
"/api/hello/:name",
|
||||
"/api/:page/:name",
|
||||
"/api/hello/:name/bar/",
|
||||
"/api/bar/:name",
|
||||
"/api/baz/foo",
|
||||
"/api/baz/foo/bar",
|
||||
"/blog/:p",
|
||||
"/posts/:b/:c",
|
||||
"/posts/b/:c/d/",
|
||||
}
|
||||
for _, route := range routes {
|
||||
recv := catchPanic(func() {
|
||||
@@ -613,7 +620,19 @@ func TestTreeTrailingSlashRedirect(t *testing.T) {
|
||||
"/admin/config/",
|
||||
"/admin/config/permissions/",
|
||||
"/doc/",
|
||||
"/admin/static/",
|
||||
"/admin/cfg/",
|
||||
"/admin/cfg/users/",
|
||||
"/api/hello/x/bar",
|
||||
"/api/baz/foo/",
|
||||
"/api/baz/bax/",
|
||||
"/api/bar/huh/",
|
||||
"/api/baz/foo/bar/",
|
||||
"/api/world/abc/",
|
||||
"/blog/pp/",
|
||||
"/posts/b/c/d",
|
||||
}
|
||||
|
||||
for _, route := range tsrRoutes {
|
||||
value := tree.getValue(route, nil, getSkippedNodes(), false)
|
||||
if value.handlers != nil {
|
||||
@@ -629,7 +648,11 @@ func TestTreeTrailingSlashRedirect(t *testing.T) {
|
||||
"/no/",
|
||||
"/_",
|
||||
"/_/",
|
||||
"/api/world/abc",
|
||||
"/api",
|
||||
"/api/",
|
||||
"/api/hello/x/foo",
|
||||
"/api/baz/foo/bad",
|
||||
"/foo/p/p",
|
||||
}
|
||||
for _, route := range noTsrRoutes {
|
||||
value := tree.getValue(route, nil, getSkippedNodes(), false)
|
||||
|
||||
Reference in New Issue
Block a user