mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
update value.tsr
match rule
This commit is contained in:
parent
82f3c92ded
commit
085b582bea
@ -395,7 +395,7 @@ func testGetRequestHandler(t *testing.T, h http.Handler, url string) {
|
|||||||
assert.Equal(t, 200, w.Code, "should get a 200")
|
assert.Equal(t, 200, w.Code, "should get a 200")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunDynamicRouting(t *testing.T) {
|
func TestTreeRunDynamicRouting(t *testing.T) {
|
||||||
router := New()
|
router := New()
|
||||||
router.GET("/aa/*xx", func(c *Context) { c.String(http.StatusOK, "/aa/*xx") })
|
router.GET("/aa/*xx", func(c *Context) { c.String(http.StatusOK, "/aa/*xx") })
|
||||||
router.GET("/ab/*xx", func(c *Context) { c.String(http.StatusOK, "/ab/*xx") })
|
router.GET("/ab/*xx", func(c *Context) { c.String(http.StatusOK, "/ab/*xx") })
|
||||||
|
5
tree.go
5
tree.go
@ -609,9 +609,8 @@ walk: // Outer loop for walking the tree
|
|||||||
|
|
||||||
// Nothing found. We can recommend to redirect to the same URL with an
|
// Nothing found. We can recommend to redirect to the same URL with an
|
||||||
// extra trailing slash if a leaf exists for that path
|
// extra trailing slash if a leaf exists for that path
|
||||||
value.tsr = (path == "/") ||
|
value.tsr = path == "/" ||
|
||||||
(len(prefix) == len(path)+1 && prefix[len(path)] == '/' &&
|
(path == prefix[:len(prefix)-1] && n.handlers != nil)
|
||||||
path == prefix[:len(prefix)-1] && n.handlers != nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user