googleapis / googleapis/google-api-go-client
transport: re-think user agents - change from replace to prepend?
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 32
Description
Currently, we allow users to set the User-Agent header via the [`WithUserAgent`](https://godoc.org/google.golang.org/api/option#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`](https://godoc.org/google.golang.org/api/googleapi)).
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
https://github.com/googleapis/google-api-go-client/blob/8ecc69ffe2df19a1b579676c8b1e0e3b5690d5e7/transport/http/dial.go#L144-L147
Contributor guide
Assessment
This issue has not been assessed yet.