Skip to content

User-Agent header set incorrectly in case of C# #158

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

Closed
peterbozso opened this issue Feb 19, 2020 · 1 comment
Closed

User-Agent header set incorrectly in case of C# #158

peterbozso opened this issue Feb 19, 2020 · 1 comment

Comments

@peterbozso
Copy link

Describe the bug
Affected code-generator: csharp-restsharp
The problem is clearly described in this issue of RestSharp: restsharp/RestSharp#787
In a nutshell, the code-generator currently sets the User-Agent like this:

request.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0");

But it's not effective at all, see issue referenced above. The solution is from the same issue as well. The correct way to set it is on the client level, like this:

client.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"

To Reproduce
Generate C# code for a request where the User-Agent header is set, then execute the generated code. Observe that the User-Agent is set to RestSharp x.x.x.x instead of the one in the generated code.

ttzztztz added a commit to ttzztztz/postman-code-generators that referenced this issue Feb 23, 2020
@ankit-m ankit-m mentioned this issue Feb 24, 2020
umeshp7 pushed a commit that referenced this issue Mar 2, 2020
@webholik
Copy link
Contributor

Fixed by #170.

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