Skip to content

Commit

Permalink
Fix for lost HttpHeader items
Browse files Browse the repository at this point in the history
In cases where there are multiple header entries with the same name,
only the first one in the collection was being copied from the OkHttp
Header to the HttpResponseMessage.Headers collection
  • Loading branch information
dwhathaway committed Jun 4, 2015
1 parent 0161be2 commit 5cf4a2d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ModernHttpClient/Android/OkHttpNetworkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage

var respHeaders = resp.Headers();
foreach (var k in respHeaders.Names()) {
ret.Headers.TryAddWithoutValidation(k, respHeaders.Get(k));
ret.Content.Headers.TryAddWithoutValidation(k, respHeaders.Get(k));
foreach (string item in respHeaders.Values(k)) {
ret.Headers.TryAddWithoutValidation(k, item);
ret.Content.Headers.TryAddWithoutValidation(k, item);
}
}

return ret;
Expand Down

0 comments on commit 5cf4a2d

Please sign in to comment.