thinkerou
2022-11-06 17:02:40 +08:00
committed by GitHub
parent 51aea73ba0
commit 8b9c55e8b0
2 changed files with 28 additions and 1 deletions
+20
View File
@@ -684,6 +684,26 @@ func TestTreeRootTrailingSlashRedirect(t *testing.T) {
}
}
func TestRedirectTrailingSlash(t *testing.T) {
var data = []struct {
path string
}{
{"/hello/:name"},
{"/hello/:name/123"},
{"/hello/:name/234"},
}
node := &node{}
for _, item := range data {
node.addRoute(item.path, fakeHandler("test"))
}
value := node.getValue("/hello/abx/", nil, getSkippedNodes(), false)
if value.tsr != true {
t.Fatalf("want true, is false")
}
}
func TestTreeFindCaseInsensitivePath(t *testing.T) {
tree := &node{}