Use clone of http.Transport defaults

This commit is contained in:
Ingo Oppermann
2023-07-07 11:23:41 +02:00
parent ccecbe3c8e
commit 97121f3ca5
4 changed files with 18 additions and 18 deletions

View File

@@ -53,12 +53,13 @@ func New(config Config) (API, error) {
}
if a.client == nil {
tr := http.DefaultTransport.(*http.Transport).Clone()
tr.MaxIdleConns = 10
tr.IdleConnTimeout = 30 * time.Second
a.client = &http.Client{
Transport: &http.Transport{
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
},
Timeout: 5 * time.Second,
Transport: tr,
Timeout: 5 * time.Second,
}
}