Fix csharp-restsharp user agent header issue#170
Fix csharp-restsharp user agent header issue#170umeshp7 merged 6 commits intopostmanlabs:developfrom
Conversation
|
Hey @ttzztztz , you need not create a new PR for adding a unit test for the fix. You can add it to your branch and the PR will be updated the latest changes. |
Oh, Got it ! Thank you for your notice! |
|
Re-run tests. |
|
@ttzztztz There are some Linting issues. https://travis-ci.com/postmanlabs/postman-code-generators/builds/151242717#L4262 |
umeshp7
left a comment
There was a problem hiding this comment.
Some lint issues found after running tests needs resolving before this can be merged.
|
@shreys7 Hello, I updated my codes and it passed the unit test and lint check. Could you please review it again? Thank you! |
|
@shreys7 Already marked. Thank you for your approval. |
I fixed issue #158 by changing the C# RestSharp API .
As He says, the
doesn't work and will be overwritten to a default UA, the official solution is to use
Instead of Add Header.
So I just fix it by checking whether a Header's key equals to
User-Agent, If so, output theclient.UserAgent = "...", otherwise, output therequest.AddHeader(..., ...).So It will work and fix the issues.
@shreys7 I added an extra unit test for my fix. This is my first time contributing to the open source community, thank you for your guidance!