Skip to content

Commit 3ff6fec

Browse files
authored
Merge pull request #4 from AMuzykus/opendata
feat: Add DisableKeepAlives http option
2 parents 683e888 + c14255f commit 3ff6fec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modules/http/client.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ func NewHTTPClientFromParams(params *object.Map) (*http.Client, error) {
5858
}
5959
}
6060

61+
// Process DisableKeepAlives option
62+
disableKeepAlives := false
63+
if disableKeepAlivesObj := params.GetWithDefault("disable_keep_alives", nil); disableKeepAlivesObj != nil {
64+
disableKeepAlivesVal, errObj := object.AsBool(disableKeepAlivesObj)
65+
if errObj != nil {
66+
return nil, errObj.Value()
67+
}
68+
disableKeepAlives = disableKeepAlivesVal
69+
}
70+
6171
transport := &http.Transport{
6272
Proxy: http.ProxyFromEnvironment,
6373
ForceAttemptHTTP2: true,
@@ -66,8 +76,7 @@ func NewHTTPClientFromParams(params *object.Map) (*http.Client, error) {
6676
TLSClientConfig: &tlsConfig,
6777
TLSHandshakeTimeout: 10 * time.Second,
6878
ExpectContinueTimeout: 1 * time.Second,
69-
// !!! For testing goals
70-
DisableKeepAlives: true,
79+
DisableKeepAlives: disableKeepAlives,
7180
}
7281

7382
if proxyObj := params.GetWithDefault("proxy", nil); proxyObj != nil {

0 commit comments

Comments
 (0)