Skip to content

Commit

Permalink
Clone net http request to avoid race
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgajg1134 committed Aug 15, 2024
1 parent e3796bd commit ed5d824
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contrib/net/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package http

import (
"context"
"net/http"
"net/http/httptest"
"strings"
Expand Down Expand Up @@ -346,9 +347,10 @@ func TestWrapHandlerWithResourceNameNoRace(_ *testing.T) {
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
req := r.Clone(context.Background())
w := httptest.NewRecorder()
defer wg.Done()
mux.ServeHTTP(w, r)
mux.ServeHTTP(w, req)
}()
}
wg.Wait()
Expand Down

0 comments on commit ed5d824

Please sign in to comment.