mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-25 14:46:02 +03:00
Possibility to replace HTTP client inside Engine
This commit is contained in:
parent
4e50a20a3c
commit
37a4c72a4b
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user