Reverted old code and added simple IgnoreCase to header dictionary
This commit is contained in:
@@ -49,9 +49,7 @@ namespace Discord.Net.Queue
|
||||
|
||||
Debug.WriteLine($"[{id}] Sending...");
|
||||
var response = await request.SendAsync().ConfigureAwait(false);
|
||||
string headerDate;
|
||||
bool headerHasDate = response.Headers.TryGetValue("Date", out headerDate);
|
||||
TimeSpan lag = DateTimeOffset.UtcNow - (headerHasDate ? DateTimeOffset.Parse(headerDate) : DateTimeOffset.UtcNow);
|
||||
TimeSpan lag = DateTimeOffset.UtcNow - DateTimeOffset.Parse(response.Headers["Date"]);
|
||||
var info = new RateLimitInfo(response.Headers);
|
||||
|
||||
if (response.StatusCode < (HttpStatusCode)200 || response.StatusCode >= (HttpStatusCode)300)
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Discord.Net.Rest
|
||||
cancelToken = CancellationTokenSource.CreateLinkedTokenSource(_cancelToken, cancelToken).Token;
|
||||
HttpResponseMessage response = await _client.SendAsync(request, cancelToken).ConfigureAwait(false);
|
||||
|
||||
var headers = response.Headers.ToDictionary(x => x.Key, x => x.Value.FirstOrDefault());
|
||||
var headers = response.Headers.ToDictionary(x => x.Key, x => x.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
||||
var stream = !headerOnly ? await response.Content.ReadAsStreamAsync().ConfigureAwait(false) : null;
|
||||
|
||||
return new RestResponse(response.StatusCode, headers, stream);
|
||||
|
||||
Reference in New Issue
Block a user