mirror of https://github.com/gin-gonic/gin.git
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…
Reference in New Issue