(b *testing.B)
| 485 | } |
| 486 | |
| 487 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…