File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package eppoclient
2
2
3
3
import (
4
4
"fmt"
5
+ "net/http"
5
6
"time"
6
7
7
8
"go.uber.org/zap"
@@ -16,6 +17,7 @@ type Config struct {
16
17
AssignmentLogger IAssignmentLogger
17
18
PollerInterval time.Duration
18
19
ApplicationLogger ApplicationLogger
20
+ HttpClient * http.Client
19
21
}
20
22
21
23
func (cfg * Config ) validate () error {
Original file line number Diff line number Diff line change @@ -14,7 +14,13 @@ func InitClient(config Config) (*EppoClient, error) {
14
14
sdkParams := SDKParams {sdkKey : config .SdkKey , sdkName : "go" , sdkVersion : __version__ }
15
15
applicationLogger := config .ApplicationLogger
16
16
17
- httpClient := newHttpClient (config .BaseUrl , & http.Client {Timeout : REQUEST_TIMEOUT_SECONDS }, sdkParams )
17
+ var httpClientInstance * http.Client
18
+ if config .HttpClient != nil {
19
+ httpClientInstance = config .HttpClient
20
+ } else {
21
+ httpClientInstance = & http.Client {Timeout : REQUEST_TIMEOUT_SECONDS }
22
+ }
23
+ httpClient := newHttpClient (config .BaseUrl , httpClientInstance , sdkParams )
18
24
configStore := newConfigurationStore ()
19
25
requestor := newConfigurationRequestor (* httpClient , configStore , applicationLogger )
20
26
You can’t perform that action at this time.
0 commit comments