| 129 | } |
| 130 | |
| 131 | func TestGzip_NoContent(t *testing.T) { |
| 132 | e := echo.New() |
| 133 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 134 | req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme) |
| 135 | rec := httptest.NewRecorder() |
| 136 | c := e.NewContext(req, rec) |
| 137 | h := Gzip()(func(c *echo.Context) error { |
| 138 | return c.NoContent(http.StatusNoContent) |
| 139 | }) |
| 140 | if assert.NoError(t, h(c)) { |
| 141 | assert.Empty(t, rec.Header().Get(echo.HeaderContentEncoding)) |
| 142 | assert.Empty(t, rec.Header().Get(echo.HeaderContentType)) |
| 143 | assert.Equal(t, 0, len(rec.Body.Bytes())) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func TestGzip_Empty(t *testing.T) { |
| 148 | e := echo.New() |