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

Function TestDecompressPoolError

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

Source from the content-addressed store, hash-verified

191}
192
193func TestDecompressPoolError(t *testing.T) {
194 e := echo.New()
195 e.Use(DecompressWithConfig(DecompressConfig{
196 Skipper: DefaultSkipper,
197 GzipDecompressPool: &TestDecompressPoolWithError{},
198 }))
199 body := `{"name": "echo"}`
200 req := httptest.NewRequest(http.MethodPost, "/echo", strings.NewReader(body))
201 req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding)
202 rec := httptest.NewRecorder()
203 c := e.NewContext(req, rec)
204
205 e.ServeHTTP(rec, req)
206
207 assert.Equal(t, GZIPEncoding, req.Header.Get(echo.HeaderContentEncoding))
208 reqBody, err := io.ReadAll(c.Request().Body)
209 assert.NoError(t, err)
210 assert.Equal(t, body, string(reqBody))
211 assert.Equal(t, rec.Code, http.StatusInternalServerError)
212}
213
214func BenchmarkDecompress(b *testing.B) {
215 e := echo.New()

Callers

nothing calls this directly

Calls 7

RequestMethod · 0.95
DecompressWithConfigFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80
ServeHTTPMethod · 0.80
UseMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…