Skip to content
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

Closed
mstum opened this issue Apr 8, 2010 · 6 comments
Closed

Add User-Agent to either the RestClient or RestRequest #20

mstum opened this issue Apr 8, 2010 · 6 comments

Comments

@mstum
Copy link
Contributor

mstum commented Apr 8, 2010

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.

@RyanFarley
Copy link
Contributor

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?

@mstum
Copy link
Contributor Author

mstum commented Apr 21, 2010

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?

@johnsheehan
Copy link
Contributor

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.

@RyanFarley
Copy link
Contributor

I added this

@johnsheehan
Copy link
Contributor

thanks!

@mstum
Copy link
Contributor Author

mstum commented Apr 23, 2010

Awesome, Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants