Skip to content

Do not override existing useragent#1668

Closed
pgherveou wants to merge 1 commit intogrpc:masterfrom
pgherveou:patch-2
Closed

Do not override existing useragent#1668
pgherveou wants to merge 1 commit intogrpc:masterfrom
pgherveou:patch-2

Conversation

@pgherveou
Copy link

It looks like the gRPC client always override the useragent passed in the metdata headers.
Would you accept such a change, where we only set the useragent if there is not one that is passed through the headers already? Happy to add tests if that looks good to you

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 22, 2021

CLA Signed

The committers are authorized under a signed CLA.

@murgatroid99
Copy link
Member

If you look at the code where this.userAgent is set, you can see that it uses channel arguments to determine that value. Our expectation is that any single client will have the same user agent for all requests it makes (or at least, all requests it makes to a single service), so you should set the value once for the whole client using those channel arguments, instead of setting it for every request.

@pgherveou
Copy link
Author

Thanks for the quick reply, We use the client to proxy upstream calls, so ideally we can just forward the ua, instead of overriding it

@murgatroid99
Copy link
Member

Our position is that even when used as a proxy, the library should send its own user agent because it is the actual source of the request. So, we are not going to add support for overriding the user agent in this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants