Skip to content

Commit f2d01dd

Browse files
authored
set http client (#897)
1 parent a274566 commit f2d01dd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/cloudagents/client.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ func New(opts ...ClientOption) (*Client, error) {
5555
if client.projectURL == "" {
5656
return nil, fmt.Errorf("project credentials are required")
5757
}
58+
if client.httpClient == nil {
59+
client.httpClient = &http.Client{}
60+
}
5861
agentClient, err := lksdk.NewAgentClient(client.projectURL, client.apiKey, client.apiSecret,
62+
lksdk.WithHTTPClient(client.httpClient),
5963
lksdk.WithTwirpClientOptions(
6064
twirp.WithClientHooks(&twirp.ClientHooks{
6165
RequestPrepared: func(ctx context.Context, req *http.Request) (context.Context, error) {
@@ -68,9 +72,6 @@ func New(opts ...ClientOption) (*Client, error) {
6872
}
6973
client.AgentClient = agentClient
7074
client.agentsURL = client.getAgentsURL("")
71-
if client.httpClient == nil {
72-
client.httpClient = &http.Client{}
73-
}
7475
return client, nil
7576
}
7677

0 commit comments

Comments
 (0)