(t *testing.T)
| 191 | } |
| 192 | |
| 193 | func TestDecompressPoolError(t *testing.T) { |
| 194 | e := echo.New() |
| 195 | e.Use(DecompressWithConfig(DecompressConfig{ |
| 196 | Skipper: DefaultSkipper, |
| 197 | GzipDecompressPool: &TestDecompressPoolWithError{}, |
| 198 | })) |
| 199 | body := `{"name": "echo"}` |
| 200 | req := httptest.NewRequest(http.MethodPost, "/echo", strings.NewReader(body)) |
| 201 | req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding) |
| 202 | rec := httptest.NewRecorder() |
| 203 | c := e.NewContext(req, rec) |
| 204 | |
| 205 | e.ServeHTTP(rec, req) |
| 206 | |
| 207 | assert.Equal(t, GZIPEncoding, req.Header.Get(echo.HeaderContentEncoding)) |
| 208 | reqBody, err := io.ReadAll(c.Request().Body) |
| 209 | assert.NoError(t, err) |
| 210 | assert.Equal(t, body, string(reqBody)) |
| 211 | assert.Equal(t, rec.Code, http.StatusInternalServerError) |
| 212 | } |
| 213 | |
| 214 | func BenchmarkDecompress(b *testing.B) { |
| 215 | e := echo.New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…