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

Function TestGzipWithMinLengthNoContent

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

Source from the content-addressed store, hash-verified

333}
334
335func TestGzipWithMinLengthNoContent(t *testing.T) {
336 e := echo.New()
337 req := httptest.NewRequest(http.MethodGet, "/", nil)
338 req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme)
339 rec := httptest.NewRecorder()
340 c := e.NewContext(req, rec)
341 h := GzipWithConfig(GzipConfig{MinLength: 10})(func(c *echo.Context) error {
342 return c.NoContent(http.StatusNoContent)
343 })
344 if assert.NoError(t, h(c)) {
345 assert.Empty(t, rec.Header().Get(echo.HeaderContentEncoding))
346 assert.Empty(t, rec.Header().Get(echo.HeaderContentType))
347 assert.Equal(t, 0, len(rec.Body.Bytes()))
348 }
349}
350
351func TestGzipResponseWriter_CanUnwrap(t *testing.T) {
352 trwu := &testResponseWriterUnwrapper{rw: httptest.NewRecorder()}

Callers

nothing calls this directly

Calls 6

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