1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-01 22:51:17 +02:00

Middleware as structs

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-02-17 21:01:47 -08:00
committed by Vishal Rana
parent e91717552f
commit c9a62e20b4
9 changed files with 187 additions and 120 deletions

View File

@@ -36,12 +36,11 @@ func TestGzip(t *testing.T) {
rec := test.NewResponseRecorder()
c := echo.NewContext(req, rec, e)
// Skip if no Accept-Encoding header
h := Gzip()(echo.HandlerFunc(func(c echo.Context) error {
h := NewGzip().Handle(echo.HandlerFunc(func(c echo.Context) error {
c.Response().Write([]byte("test")) // For Content-Type sniffing
return nil
}))
h.Handle(c)
// assert.Equal(t, http.StatusOK, rec.Status())
assert.Equal(t, "test", rec.Body.String())
req = test.NewRequest(echo.GET, "/", nil)