Exercises the global middleware chain (finding #1). Five pass-through middlewares.
(b *testing.B)
| 50 | |
| 51 | // Exercises the global middleware chain (finding #1). Five pass-through middlewares. |
| 52 | func BenchmarkServeHTTP_Middleware(b *testing.B) { |
| 53 | e := New() |
| 54 | for i := 0; i < 5; i++ { |
| 55 | e.Use(func(next HandlerFunc) HandlerFunc { |
| 56 | return func(c *Context) error { return next(c) } |
| 57 | }) |
| 58 | } |
| 59 | e.GET("/users/:id", func(c *Context) error { return c.NoContent(http.StatusOK) }) |
| 60 | req := httptest.NewRequest(http.MethodGet, "/users/42", nil) |
| 61 | benchServe(b, e, req) |
| 62 | } |
| 63 | |
| 64 | func BenchmarkServeHTTP_String(b *testing.B) { |
| 65 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…