Skip to content

Commit

Permalink
fix pass user-agent (#138)
Browse files Browse the repository at this point in the history
* fix pass user-agent

* Revert "fix pass user-agent"

This reverts commit 76ac58e.

* Revert "Revert "fix pass user-agent""

This reverts commit a6b2bd0.

* tune agent
  • Loading branch information
flaneur2020 authored Sep 11, 2024
1 parent bf97a20 commit 793edec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,10 @@ func (c *APIClient) authMethod() AuthMethod {
func (c *APIClient) makeHeaders(ctx context.Context) (http.Header, error) {
headers := http.Header{}
headers.Set(WarehouseRoute, "warehouse")
headers.Set(UserAgent, fmt.Sprintf("databend-go/%s", version))
if userAgent, ok := ctx.Value(ContextUserAgentID).(string); ok {
headers.Set(UserAgent, fmt.Sprintf("%s/databend-go/%s", version, userAgent))
} else {
headers.Set(UserAgent, fmt.Sprintf("databend-go/%s", version))
headers.Set(UserAgent, fmt.Sprintf("databend-go/%s/%s", version, userAgent))
}
headers.Set(UserAgent, fmt.Sprintf("databend-go/%s", version))
if c.tenant != "" {
headers.Set(DatabendTenantHeader, c.tenant)
}
Expand Down

0 comments on commit 793edec

Please sign in to comment.