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

Function TestDecompress_skippedIfNoHeader

middleware/decompress_test.go:46–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestDecompress_skippedIfNoHeader(t *testing.T) {
47 e := echo.New()
48 req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader("test"))
49 rec := httptest.NewRecorder()
50 c := e.NewContext(req, rec)
51
52 // Skip if no Content-Encoding header
53 h := Decompress()(func(c *echo.Context) error {
54 c.Response().Write([]byte("test")) // For Content-Type sniffing
55 return nil
56 })
57
58 err := h(c)
59 assert.NoError(t, err)
60 assert.Equal(t, "test", rec.Body.String())
61
62}
63
64func TestDecompressWithConfig_DefaultConfig_noDecode(t *testing.T) {
65 e := echo.New()

Callers

nothing calls this directly

Calls 5

ResponseMethod · 0.95
DecompressFunction · 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…