Skip to content

Commit

Permalink
fix: copy DefaultTransport (#82)
Browse files Browse the repository at this point in the history
* fix: copy DefaultTransport

* chore: fixed tests

* chore: fix time
  • Loading branch information
freak12techno authored Sep 21, 2024
1 parent 5e72ba8 commit dce4f73
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@ func (c *Client) Get(
childCtx, span := c.tracer.Start(ctx, "HTTP request")
defer span.End()

var transport http.RoundTripper

transportRaw, ok := http.DefaultTransport.(*http.Transport)
if ok {
transport = transportRaw.Clone()
} else {
transport = http.DefaultTransport
}

client := &http.Client{
Timeout: 10 * 1000000000,
Transport: otelhttp.NewTransport(http.DefaultTransport),
Timeout: 10 * time.Second,
Transport: otelhttp.NewTransport(transport),
}
start := time.Now()

Expand Down

0 comments on commit dce4f73

Please sign in to comment.