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

Function BenchmarkDecompress_WithLimit

middleware/decompress_test.go:487–508  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

485}
486
487func BenchmarkDecompress_WithLimit(b *testing.B) {
488 e := echo.New()
489 body := strings.Repeat("benchmark data ", 1000) // ~15KB
490 gz, _ := gzipString(body)
491
492 h, _ := DecompressConfig{MaxDecompressedSize: 100 * MB}.ToMiddleware()
493
494 b.ReportAllocs()
495 b.ResetTimer()
496
497 for i := 0; i < b.N; i++ {
498 req := httptest.NewRequest(http.MethodPost, "/", bytes.NewReader(gz))
499 req.Header.Set(echo.HeaderContentEncoding, GZIPEncoding)
500 rec := httptest.NewRecorder()
501 c := e.NewContext(req, rec)
502
503 h(func(c *echo.Context) error {
504 io.ReadAll(c.Request().Body)
505 return nil
506 })(c)
507 }
508}

Callers

nothing calls this directly

Calls 5

RequestMethod · 0.95
gzipStringFunction · 0.85
SetMethod · 0.80
NewContextMethod · 0.80
ToMiddlewareMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…