From 431c74b707dc33b3b0e5409e46828f554f0d44c2 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sun, 22 Sep 2024 01:44:53 +0300 Subject: [PATCH] fix: copy DefaultTransport --- pkg/http/client.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/http/client.go b/pkg/http/client.go index 61661cd..71f4de3 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -43,7 +43,19 @@ func (c *Client) GetWithHeaders( ) (error, query_info.QueryInfo) { url := fmt.Sprintf("%s%s", c.host, relativeURL) - client := &http.Client{Timeout: c.timeout} + var transport http.RoundTripper + + transportRaw, ok := http.DefaultTransport.(*http.Transport) + if ok { + transport = transportRaw.Clone() + } else { + transport = http.DefaultTransport + } + + client := &http.Client{ + Timeout: c.timeout, + Transport: transport, + } start := time.Now() queryInfo := query_info.QueryInfo{ Success: false,