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

Function TestGzip_ErrorReturned

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

Source from the content-addressed store, hash-verified

166}
167
168func TestGzip_ErrorReturned(t *testing.T) {
169 e := echo.New()
170 e.Use(Gzip())
171 e.GET("/", func(c *echo.Context) error {
172 return echo.ErrNotFound
173 })
174 req := httptest.NewRequest(http.MethodGet, "/", nil)
175 req.Header.Set(echo.HeaderAcceptEncoding, gzipScheme)
176 rec := httptest.NewRecorder()
177 e.ServeHTTP(rec, req)
178 assert.Equal(t, http.StatusNotFound, rec.Code)
179 assert.Empty(t, rec.Header().Get(echo.HeaderContentEncoding))
180}
181
182func TestGzipWithConfig_invalidLevel(t *testing.T) {
183 mw, err := GzipConfig{Level: 12}.ToMiddleware()

Callers

nothing calls this directly

Calls 7

GzipFunction · 0.85
SetMethod · 0.80
ServeHTTPMethod · 0.80
UseMethod · 0.45
GETMethod · 0.45
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…