Occasionally the API will respond with a 429 with no rate limit headers, see example:
HTTP/1.1 429 Unknown
Content-Length: 22
Content-Type: text/html; charset=UTF-8
429 Too Many Requests.
In this case the RateLimitExtension gets an error because it expects the X-RateLimit-Window header to be present:
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The given header was not found.
at System.Net.Http.Headers.HttpHeaders.GetValues(String name)
at RingCentral.Net.RateLimit.RateLimitExtension.<>c__DisplayClass1_0.<DefaultOptions>b__1(RestException restException, Int32 retriesAttempted)
at RingCentral.Net.Retry.RetryExtension.<>c__DisplayClass2_0.<<Install>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
It should be using TryGetValues instead of GetValues since the header may not exist in the response.
Occasionally the API will respond with a 429 with no rate limit headers, see example:
In this case the RateLimitExtension gets an error because it expects the X-RateLimit-Window header to be present:
It should be using TryGetValues instead of GetValues since the header may not exist in the response.