Skip to content

Commit 365efc0

Browse files
committed
disable keep-alive connections for REST API http client
1 parent f743707 commit 365efc0

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/zeropsRestApiClient/handler.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ type Handler struct {
1616
func NewAuthorizedClient(token string, regionUrl string) *Handler {
1717
config := sdkBase.DefaultConfig(sdkBase.WithCustomEndpoint(regionUrl))
1818

19+
httpClient := &http.Client{
20+
Transport: &http.Transport{
21+
DisableKeepAlives: true,
22+
},
23+
}
24+
1925
return &Handler{
20-
Handler: sdk.AuthorizeSdk(sdk.New(config, http.DefaultClient), token),
26+
Handler: sdk.AuthorizeSdk(sdk.New(config, httpClient), token),
2127
// temporary solution, I need my own endpoints
22-
env: sdkBase.NewEnvironment(config, http.DefaultClient).Authorize(token),
28+
env: sdkBase.NewEnvironment(config, httpClient).Authorize(token),
2329
}
2430
}

0 commit comments

Comments
 (0)