Skip to content

Commit

Permalink
test(reqid): add banch
Browse files Browse the repository at this point in the history
  • Loading branch information
olexsmir committed Sep 19, 2024
1 parent f7c1bd3 commit 9f8eb08
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/transport/http/reqid/reqid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ func TestMiddleware(t *testing.T) {
assert.Equal(t, http.StatusOK, w.Code)
assert.NotEmpty(t, w.Header().Get(headerRequestID))
}

func BenchmarkMiddleware(b *testing.B) {
r := gin.New()
r.Use(Middleware())
r.GET("/", testHandler)

w := httptest.NewRecorder()
req, err := http.NewRequest(http.MethodGet, "/", nil)
require.NoError(b, err)

for i := 0; i < b.N; i++ {
r.ServeHTTP(w, req)
}
}

0 comments on commit 9f8eb08

Please sign in to comment.