handle case insensitive headers when parsing for API rate limiting (#2175)

This commit is contained in:
Brendan Forster
2020-04-12 13:04:30 -03:00
committed by GitHub
parent 2bfd101bd0
commit 8d7bda96e4
8 changed files with 103 additions and 18 deletions
@@ -53,6 +53,17 @@ namespace Octokit.Tests.Exceptions
Assert.Equal(30, abuseException.RetryAfterSeconds);
}
[Fact]
public void WithRetryAfterCaseInsensitiveHeader_PopulatesRetryAfterSeconds()
{
var headerDictionary = new Dictionary<string, string> { { "retry-after", "20" } };
var response = new Response(HttpStatusCode.Forbidden, null, headerDictionary, "application/json");
var abuseException = new AbuseException(response);
Assert.Equal(20, abuseException.RetryAfterSeconds);
}
[Fact]
public void WithZeroHeaderValue_RetryAfterSecondsIsZero()
{