diff --git a/fc/client.go b/fc/client.go index f52d22e..514f392 100644 --- a/fc/client.go +++ b/fc/client.go @@ -39,8 +39,11 @@ func NewFullContactClient(options ...ClientOption) (*fullContactClient, error) { if c.retryHandler == nil { c.retryHandler = &DefaultRetryHandler{} } - c.httpClient = &http.Client{ - Timeout: time.Duration(c.connectTimeoutMillis) * time.Millisecond, + + if c.httpClient == nil { + c.httpClient = &http.Client{ + Timeout: time.Duration(c.connectTimeoutMillis) * time.Millisecond, + } } return c, nil @@ -71,3 +74,9 @@ func WithRetryHandler(retryHandler RetryHandler) ClientOption { fc.retryHandler = retryHandler } } + +func WithHTTPClient(httpClient *http.Client) ClientOption { + return func(fc *fullContactClient) { + fc.httpClient = httpClient + } +}