(t *testing.T)
| 240 | } |
| 241 | |
| 242 | func TestGzipWithMinLengthTooShort(t *testing.T) { |
| 243 | e := echo.New() |
| 244 | // Minimal response length |
| 245 | e.Use(GzipWithConfig(GzipConfig{MinLength: 10})) |
| 246 | e.GET("/", func(c *echo.Context) error { |
| 247 | c.Response().Write([]byte("test")) |
| 248 | return nil |
| 249 | }) |
| 250 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 251 | req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme) |
| 252 | rec := httptest.NewRecorder() |
| 253 | e.ServeHTTP(rec, req) |
| 254 | assert.Equal(t, "", rec.Header().Get(echo.HeaderContentEncoding)) |
| 255 | assert.Contains(t, rec.Body.String(), "test") |
| 256 | } |
| 257 | |
| 258 | func TestGzipWithResponseWithoutBody(t *testing.T) { |
| 259 | e := echo.New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…