-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Currently, we allow users to set the User-Agent header via the WithUserAgent client option.
There's also the "UserAgent" field in the JSON/REST generated clients (this repo) which is appended to the default user agent (googleapi.UserAgent).
This option sets the User-Agent in its entirety, which means the client doesn't send its default User-Agent. It also makes it a bit more difficult for intermediary libraries to allow their users to set the User-Agent (think about a terraform library, for instance, you could end up with three user agents: end user, terraform, api client).
We might need some way to prepend user agent strings.
Questions:
- do we actually to make a change? is our default User-Agent important?
- prepend or append?
see PR #490
google-api-go-client/transport/http/dial.go
Lines 144 to 147 in 8ecc69f
| if t.userAgent != "" { | |
| // TODO(cbro): append to existing User-Agent header? | |
| newReq.Header.Set("User-Agent", t.userAgent) | |
| } |