MCPcopy Index your code
hub / github.com/labstack/echo / TestDecompressNoContent

Function TestDecompressNoContent

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

Source from the content-addressed store, hash-verified

124}
125
126func TestDecompressNoContent(t *testing.T) {
127 e := echo.New()
128 req := httptest.NewRequest(http.MethodGet, "/", nil)
129 req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding)
130 rec := httptest.NewRecorder()
131 c := e.NewContext(req, rec)
132 h := Decompress()(func(c *echo.Context) error {
133 return c.NoContent(http.StatusNoContent)
134 })
135
136 err := h(c)
137
138 if assert.NoError(t, err) {
139 assert.Equal(t, GZIPEncoding, req.Header.Get(echo.HeaderContentEncoding))
140 assert.Empty(t, rec.Header().Get(echo.HeaderContentType))
141 assert.Equal(t, 0, len(rec.Body.Bytes()))
142 }
143}
144
145func TestDecompressErrorReturned(t *testing.T) {
146 e := echo.New()

Callers

nothing calls this directly

Calls 6

NoContentMethod · 0.95
DecompressFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…