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

Function TestGzip_NoContent

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

Source from the content-addressed store, hash-verified

129}
130
131func TestGzip_NoContent(t *testing.T) {
132 e := echo.New()
133 req := httptest.NewRequest(http.MethodGet, "/", nil)
134 req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme)
135 rec := httptest.NewRecorder()
136 c := e.NewContext(req, rec)
137 h := Gzip()(func(c *echo.Context) error {
138 return c.NoContent(http.StatusNoContent)
139 })
140 if assert.NoError(t, h(c)) {
141 assert.Empty(t, rec.Header().Get(echo.HeaderContentEncoding))
142 assert.Empty(t, rec.Header().Get(echo.HeaderContentType))
143 assert.Equal(t, 0, len(rec.Body.Bytes()))
144 }
145}
146
147func TestGzip_Empty(t *testing.T) {
148 e := echo.New()

Callers

nothing calls this directly

Calls 6

NoContentMethod · 0.95
GzipFunction · 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…