Skip to content

Commit

Permalink
fix: copy DefaultTransport (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno authored Sep 21, 2024
1 parent 70b04fd commit 8c0c001
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ func NewClient(logger zerolog.Logger, invoker, host string) *Client {
}

func (c *Client) GetInternal(relativeURL string) (io.ReadCloser, error) {
client := &http.Client{Timeout: 300 * time.Second}
var transport http.RoundTripper

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

client := &http.Client{Timeout: 300 * time.Second, Transport: transport}
start := time.Now()

fullURL := fmt.Sprintf("%s%s", c.Host, relativeURL)
Expand Down

0 comments on commit 8c0c001

Please sign in to comment.