mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
parent
29db90e1fc
commit
b7dd5120ef
@ -149,8 +149,13 @@ func TestRouteRedirectTrailingSlash(t *testing.T) {
|
|||||||
router.GET("/path2/", func(c *Context) {})
|
router.GET("/path2/", func(c *Context) {})
|
||||||
router.POST("/path3", func(c *Context) {})
|
router.POST("/path3", func(c *Context) {})
|
||||||
router.PUT("/path4/", func(c *Context) {})
|
router.PUT("/path4/", func(c *Context) {})
|
||||||
|
router.GET("/:param1/:param2", func(c *Context) {})
|
||||||
|
|
||||||
w := PerformRequest(router, http.MethodGet, "/path/")
|
w := PerformRequest(router, http.MethodGet, "//path/")
|
||||||
|
assert.Equal(t, "/path", w.Header().Get("Location"))
|
||||||
|
assert.Equal(t, http.StatusMovedPermanently, w.Code)
|
||||||
|
|
||||||
|
w = PerformRequest(router, http.MethodGet, "/path/")
|
||||||
assert.Equal(t, "/path", w.Header().Get("Location"))
|
assert.Equal(t, "/path", w.Header().Get("Location"))
|
||||||
assert.Equal(t, http.StatusMovedPermanently, w.Code)
|
assert.Equal(t, http.StatusMovedPermanently, w.Code)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user