-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add User-Agent to either the RestClient or RestRequest #20
Comments
I added UserAgent to my fork, but I only added it to the RestClient, not the RestRequest. What would a use-case be for overriding it for a particular request? |
Haven't seen a case for it TBH. I could imagine some test application impersonating different clients/bots, but I think that's a rather small use case. Did you change the _restrictedHeaderActions in Http.cs to throw away the user-agent if set as a Header-parameter? If not, that would give users the option to override it anyway without the need to have an overly visible property on the RestRequest that could confuse people. Should there be a default User-Agent ("RestSharp 1.x.x.x") or would that be to obnoxious? |
I don't mind a default. I've run into APIs that will reject requests if there isn't one so it's probably good to have a default. |
I added this |
thanks! |
Awesome, Thanks! |
I can specify the User-agent by manually adding a Header, but maybe it should be exposed as a property on the RestClient or the RestRequest (or even on both, with the Client serving as a "global" one and the Request being able to override it on a single request).
This should emphasize the importance of it, I'm even thinking of making it mandatory to specify one in my branch. As a server operator, the User-Agent is really helpful, especially when deciding whether or not to ban a client making too many requests.
The text was updated successfully, but these errors were encountered: