-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adding a manual User-Agent get overwritten by the User-Agent of the RestClient #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
i'll see what can be done to allow the user content to remain and not get overridden. |
@newnottakenname to set the user-agent, please use
(where RestClient is an instance of RestClient) |
Although I agree that it is best practice to use OOP to set an User-Agent, instead of adding a header, I believe that adding a header should always overrule the user agent or at least give a warning to tell the programmer that the header has no effect on the actual User-Agent. It took me 2 weeks to figure out that nothing was being changed. I would like to prevent future programmers this problem. |
To add to this, we have a requirement that the User agent is changed for almost every request made out, we re-use the Restsharp client instance across many threads, so setting the header for the individual request feels like the right way to go here. Also, if you are blowing away a value I have set, throw an exception stating I can't set the property, rather than silently replacing it. |
|
When adding a header like this
restClient.AddHeader("User-Agent","My-User-Agent")
the RestClient will overrule this with the default "RestSharp 1.x.x.x" like is discussed in this issue. Can this be fixed, so that in the future, people will not be weirded out, when they need to set the User-Agent and it doesn't do anything? ;)
The text was updated successfully, but these errors were encountered: