diff --git a/v3/client.go b/v3/client.go index 6792c1927..ec4976070 100755 --- a/v3/client.go +++ b/v3/client.go @@ -214,6 +214,7 @@ func (c *Client) WithTrace() *Client { } // WithHttpClient returns a copy of Client with new http.Client. +// Deprecated: use WithHTTPClient instead. func (c *Client) WithHttpClient(client *http.Client) *Client { clone := cloneClient(c) @@ -222,6 +223,15 @@ func (c *Client) WithHttpClient(client *http.Client) *Client { return clone } +// WithHTTPClient returns a copy of Client with new http.Client. +func (c *Client) WithHTTPClient(client *http.Client) *Client { + clone := cloneClient(c) + + clone.httpClient = client + + return clone +} + // WithRequestInterceptor returns a copy of Client with new RequestInterceptors. func (c *Client) WithRequestInterceptor(f ...RequestInterceptorFn) *Client { clone := cloneClient(c) diff --git a/v3/generator/client/client.tmpl b/v3/generator/client/client.tmpl index 67e3c7030..d3a04eca2 100644 --- a/v3/generator/client/client.tmpl +++ b/v3/generator/client/client.tmpl @@ -192,6 +192,7 @@ func (c *Client) WithTrace() *Client { } // WithHttpClient returns a copy of Client with new http.Client. +// Deprecated: use WithHTTPClient instead. func (c *Client) WithHttpClient(client *http.Client) *Client { clone := cloneClient(c) @@ -200,6 +201,15 @@ func (c *Client) WithHttpClient(client *http.Client) *Client { return clone } +// WithHTTPClient returns a copy of Client with new http.Client. +func (c *Client) WithHTTPClient(client *http.Client) *Client { + clone := cloneClient(c) + + clone.httpClient = client + + return clone +} + // WithRequestInterceptor returns a copy of Client with new RequestInterceptors. func (c *Client) WithRequestInterceptor(f ...RequestInterceptorFn) *Client { clone := cloneClient(c)