fix(route): redirectSlash bug (#3227)
fixes https://github.com/gin-gonic/gin/issues/2959 fixes https://github.com/gin-gonic/gin/issues/2282 fixes https://github.com/gin-gonic/gin/issues/2211
This commit is contained in:
@@ -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{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user