Skip to content

Commit

Permalink
fix for comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <[email protected]>
  • Loading branch information
fatsheep9146 committed Jul 26, 2022
1 parent b7bdeee commit 889020d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### 💡 Enhancements 💡

- Deprecate `HTTPClientSettings.ToClientWithHost` (#5737)

### 🧰 Bug fixes 🧰

## v0.56.0 Beta
Expand Down
10 changes: 8 additions & 2 deletions config/confighttp/confighttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ func (hcs *HTTPClientSettings) ToClient(host component.Host, settings component.
}

if hcs.Auth != nil {
if host.GetExtensions() == nil {
ext := host.GetExtensions()
if ext == nil {
return nil, errors.New("extensions configuration not found")
}

httpCustomAuthRoundTripper, aerr := hcs.Auth.GetClientAuthenticator(host.GetExtensions())
httpCustomAuthRoundTripper, aerr := hcs.Auth.GetClientAuthenticator(ext)
if aerr != nil {
return nil, aerr
}
Expand All @@ -182,6 +183,11 @@ func (hcs *HTTPClientSettings) ToClient(host component.Host, settings component.
}, nil
}

// Deprecated: [v0.57.0] use ToClient.
func (hcs *HTTPClientSettings) ToClientWithHost(host component.Host, settings component.TelemetrySettings) (*http.Client, error) {
return hcs.ToClient(host, settings)
}

// Custom RoundTripper that adds headers.
type headerRoundTripper struct {
transport http.RoundTripper
Expand Down

0 comments on commit 889020d

Please sign in to comment.