fix(router): tree bug where loop index is not decremented. (#3460)
fixes https://github.com/gin-gonic/gin/issues/3459
This commit is contained in:
committed by
GitHub
parent
c58e0d59ca
commit
8eb5f832ba
@@ -670,3 +670,22 @@ func TestRouteContextHoldsFullPath(t *testing.T) {
|
||||
w := PerformRequest(router, http.MethodGet, "/not-found")
|
||||
assert.Equal(t, http.StatusNotFound, w.Code)
|
||||
}
|
||||
|
||||
func TestEngineHandleMethodNotAllowedCornerCase(t *testing.T) {
|
||||
r := New()
|
||||
r.HandleMethodNotAllowed = true
|
||||
|
||||
base := r.Group("base")
|
||||
base.GET("/metrics", handlerTest1)
|
||||
|
||||
v1 := base.Group("v1")
|
||||
|
||||
v1.GET("/:id/devices", handlerTest1)
|
||||
v1.GET("/user/:id/groups", handlerTest1)
|
||||
|
||||
v1.GET("/orgs/:id", handlerTest1)
|
||||
v1.DELETE("/orgs/:id", handlerTest1)
|
||||
|
||||
w := PerformRequest(r, "GET", "/base/v1/user/groups")
|
||||
assert.Equal(t, http.StatusNotFound, w.Code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user