Skip to content

Commit

Permalink
v3: fix WithHttpClient name (#661)
Browse files Browse the repository at this point in the history
# Description

- deprecate `WithHttpClient`
- add `WithHTTPClient`

Use the same initialism as `ClientOptWithHTTPClient`.
  • Loading branch information
ldez authored Sep 24, 2024
1 parent 35cad98 commit 75ebcdc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions v3/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions v3/generator/client/client.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 75ebcdc

Please sign in to comment.