MCPcopy
hub / github.com/labstack/echo / TestGzipWithMinLengthTooShort

Function TestGzipWithMinLengthTooShort

middleware/compress_test.go:242–256  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

240}
241
242func 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
258func TestGzipWithResponseWithoutBody(t *testing.T) {
259 e := echo.New()

Callers

nothing calls this directly

Calls 10

GzipWithConfigFunction · 0.85
ResponseMethod · 0.80
SetMethod · 0.80
ServeHTTPMethod · 0.80
UseMethod · 0.45
GETMethod · 0.45
WriteMethod · 0.45
GetMethod · 0.45
HeaderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…