(t *testing.T)
| 159 | } |
| 160 | |
| 161 | func TestDecompressSkipper(t *testing.T) { |
| 162 | e := echo.New() |
| 163 | e.Use(DecompressWithConfig(DecompressConfig{ |
| 164 | Skipper: func(c *echo.Context) bool { |
| 165 | return c.Request().URL.Path == "/skip" |
| 166 | }, |
| 167 | })) |
| 168 | body := `{"name": "echo"}` |
| 169 | req := httptest.NewRequest(http.MethodPost, "/skip", strings.NewReader(body)) |
| 170 | req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding) |
| 171 | rec := httptest.NewRecorder() |
| 172 | c := e.NewContext(req, rec) |
| 173 | |
| 174 | e.ServeHTTP(rec, req) |
| 175 | |
| 176 | assert.Equal(t, rec.Header().Get(echo.HeaderContentType), echo.MIMEApplicationJSON) |
| 177 | reqBody, err := io.ReadAll(c.Request().Body) |
| 178 | assert.NoError(t, err) |
| 179 | assert.Equal(t, body, string(reqBody)) |
| 180 | } |
| 181 | |
| 182 | type TestDecompressPoolWithError struct { |
| 183 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…