1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Middleware and handler as closure

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-02-17 21:49:31 -08:00
parent c9a62e20b4
commit 88f307bedd
9 changed files with 180 additions and 230 deletions

View File

@@ -15,7 +15,7 @@ func TestRecover(t *testing.T) {
req := test.NewRequest(echo.GET, "/", nil)
rec := test.NewResponseRecorder()
c := echo.NewContext(req, rec, e)
h := NewRecover().Handle(echo.HandlerFunc(func(c echo.Context) error {
h := Recover()(echo.HandlerFunc(func(c echo.Context) error {
panic("test")
}))
h.Handle(c)