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
22
33import (
44 "fmt"
5+ "net/http"
56 "time"
67
78 "go.uber.org/zap"
@@ -16,6 +17,7 @@ type Config struct {
1617 AssignmentLogger IAssignmentLogger
1718 PollerInterval time.Duration
1819 ApplicationLogger ApplicationLogger
20+ HttpClient * http.Client
1921}
2022
2123func (cfg * Config ) validate () error {
Original file line number Diff line number Diff line change @@ -14,7 +14,13 @@ func InitClient(config Config) (*EppoClient, error) {
1414 sdkParams := SDKParams {sdkKey : config .SdkKey , sdkName : "go" , sdkVersion : __version__ }
1515 applicationLogger := config .ApplicationLogger
1616
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 )
1824 configStore := newConfigurationStore ()
1925 requestor := newConfigurationRequestor (* httpClient , configStore , applicationLogger )
2026
You can’t perform that action at this time.
0 commit comments