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

Function TestGzip_NoAcceptEncodingHeader

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

Source from the content-addressed store, hash-verified

18)
19
20func TestGzip_NoAcceptEncodingHeader(t *testing.T) {
21 // Skip if no Accept-Encoding header
22 h := Gzip()(func(c *echo.Context) error {
23 c.Response().Write([]byte("test")) // For Content-Type sniffing
24 return nil
25 })
26
27 e := echo.New()
28 req := httptest.NewRequest(http.MethodGet, "/", nil)
29 rec := httptest.NewRecorder()
30 c := e.NewContext(req, rec)
31
32 err := h(c)
33 assert.NoError(t, err)
34
35 assert.Equal(t, "test", rec.Body.String())
36}
37
38func TestMustGzipWithConfig_panics(t *testing.T) {
39 assert.Panics(t, func() {

Callers

nothing calls this directly

Calls 5

ResponseMethod · 0.95
GzipFunction · 0.85
NewContextMethod · 0.80
WriteMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…