DYN-2239 Set the UserAgent for HttpWebRequest#11293
DYN-2239 Set the UserAgent for HttpWebRequest#11293QilongTang merged 3 commits intoDynamoDS:masterfrom
Conversation
| var myRequest = System.Net.WebRequest.Create(uriResult); | ||
|
|
||
| if (myRequest is System.Net.HttpWebRequest httpRequest) | ||
| httpRequest.UserAgent = "Dynamo"; |
There was a problem hiding this comment.
Could you add a comment describing why this is needed?
| { | ||
| string url = "https://api.github.com/repos/DynamoDS/Dynamo/issues?page=0&state=closed&per_page=10"; | ||
| string result = Web.WebRequestByUrl(url); | ||
| Assert.IsNotNullOrEmpty(result); |
There was a problem hiding this comment.
Please consider replacing the first test in this file, since this is a better version of it.
There was a problem hiding this comment.
Please consider replacing the first test in this file, since this is a better version of it.
@mmisol It looks like the GitHub API has a rate limit of 60 requests per hour per originating IP for unauthenticated
requests (https://developer.github.com/v3/#rate-limiting). If this is exceeded then the test will likely fail due to a 403 response. I'm not familiar with how your test infrastructure is setup so is this likely to cause an issue?
There was a problem hiding this comment.
I've addressed this in commit 190a1e7. Removed the WebRequest_ValidArgs test and revised the GitHub API request to /rate_limit as requests to this endpoint do not count against your API rate limits.
* Set the UserAgent for HttpWebRequest * Added WebRequest_GitHubAPI test * Replaced WebRequest_ValidArgs test. Added comment. Revised GitHub API endpoint.
* Set the UserAgent for HttpWebRequest * Added WebRequest_GitHubAPI test * Replaced WebRequest_ValidArgs test. Added comment. Revised GitHub API endpoint. Co-authored-by: Laurence Elsdon <[email protected]>
Purpose
JIRA: DYN-2239
Set the
UserAgentforHTTPWebRequestwhich is required by some APIs including GitHub: https://developer.github.com/v3/#user-agent-requiredBehaviour before:

Behaviour after:

Declarations
Check these if you believe they are true
*.resxfilesReviewers
@mjkkirschner @QilongTang @mmisol
FYIs
@Amoursol