(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestDecompressNoContent(t *testing.T) { |
| 127 | e := echo.New() |
| 128 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 129 | req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding) |
| 130 | rec := httptest.NewRecorder() |
| 131 | c := e.NewContext(req, rec) |
| 132 | h := Decompress()(func(c *echo.Context) error { |
| 133 | return c.NoContent(http.StatusNoContent) |
| 134 | }) |
| 135 | |
| 136 | err := h(c) |
| 137 | |
| 138 | if assert.NoError(t, err) { |
| 139 | assert.Equal(t, GZIPEncoding, req.Header.Get(echo.HeaderContentEncoding)) |
| 140 | assert.Empty(t, rec.Header().Get(echo.HeaderContentType)) |
| 141 | assert.Equal(t, 0, len(rec.Body.Bytes())) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func TestDecompressErrorReturned(t *testing.T) { |
| 146 | e := echo.New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…