Skip to content

Commit

Permalink
Setup tranport to match default
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaznocha committed Dec 6, 2023
1 parent 190d5f1 commit f78dfda
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/flaghttp/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package flaghttp

import (
"net"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -34,8 +35,19 @@ type client struct {

func NewClient() Client {
return &client{
header: http.Header{},
transport: &http.Transport{},
header: http.Header{},
transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}
}

Expand Down

0 comments on commit f78dfda

Please sign in to comment.