diff --git a/core/engine.go b/core/engine.go index ae98a07..057809d 100644 --- a/core/engine.go +++ b/core/engine.go @@ -139,6 +139,15 @@ func (e *Engine) BuildHTTPClient(replaceDefault ...bool) *Engine { return e } +// SetHTTPClient sets HTTP client to engine +func (e *Engine) SetHTTPClient(client *http.Client) *Engine { + if client != nil { + e.httpClient = client + } + + return e +} + // HTTPClient returns inner http client or default http client func (e *Engine) HTTPClient() *http.Client { if e.httpClient == nil { diff --git a/core/http_client_builder.go b/core/http_client_builder.go index 41a0be3..2b53b4c 100644 --- a/core/http_client_builder.go +++ b/core/http_client_builder.go @@ -117,8 +117,8 @@ func (b *HTTPClientBuilder) FromConfig(config *HTTPClientConfig) *HTTPClientBuil } if config.MockAddress != "" { - b.mockAddress = config.MockAddress - b.mockedDomains = config.MockedDomains + b.SetMockAddress(config.MockAddress) + b.SetMockedDomains(config.MockedDomains) } if config.Timeout > 0 {