chore: add return or remove else for reduce indent (#1470)

This commit is contained in:
田欧
2018-08-12 21:17:57 +08:00
committed by Bo-Yi Wu
parent 7e64d32269
commit e5bb4f62a2
2 changed files with 46 additions and 33 deletions
+10
View File
@@ -333,6 +333,16 @@ func TestRouteNotAllowedEnabled(t *testing.T) {
assert.Equal(t, http.StatusTeapot, w.Code)
}
func TestRouteNotAllowedEnabled2(t *testing.T) {
router := New()
router.HandleMethodNotAllowed = true
// add one methodTree to trees
router.addRoute("POST", "/", HandlersChain{func(_ *Context) {}})
router.GET("/path2", func(c *Context) {})
w := performRequest(router, "POST", "/path2")
assert.Equal(t, http.StatusMethodNotAllowed, w.Code)
}
func TestRouteNotAllowedDisabled(t *testing.T) {
router := New()
router.HandleMethodNotAllowed = false