Better API for RouteGroup.Handle()

This commit is contained in:
Manu Mtz-Almeida
2015-05-19 23:22:35 +02:00
parent 53329e4646
commit 022304e7d9
5 changed files with 39 additions and 35 deletions
+6 -6
View File
@@ -30,9 +30,9 @@ func testRouteOK(method string, t *testing.T) {
r.Any("/test2", func(c *Context) {
passedAny = true
})
r.Handle(method, "/test", HandlersChain{func(c *Context) {
r.Handle(method, "/test", func(c *Context) {
passed = true
}})
})
w := performRequest(r, method, "/test")
assert.True(t, passed)
@@ -47,9 +47,9 @@ func testRouteOK(method string, t *testing.T) {
func testRouteNotOK(method string, t *testing.T) {
passed := false
router := New()
router.Handle(method, "/test_2", HandlersChain{func(c *Context) {
router.Handle(method, "/test_2", func(c *Context) {
passed = true
}})
})
w := performRequest(router, method, "/test")
@@ -67,9 +67,9 @@ func testRouteNotOK2(method string, t *testing.T) {
} else {
methodRoute = "POST"
}
router.Handle(methodRoute, "/test", HandlersChain{func(c *Context) {
router.Handle(methodRoute, "/test", func(c *Context) {
passed = true
}})
})
w := performRequest(router, method, "/test")