From 86fc72c68a94054e4b833d89507a49bf99561a2c Mon Sep 17 00:00:00 2001 From: erickoledadevrel Date: Tue, 9 Jun 2015 11:44:24 -0700 Subject: [PATCH] Fix bug with multiple HTTP headers in batch requests. Fixes #548. --- Src/GoogleApis/Apis/Requests/BatchRequest.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Src/GoogleApis/Apis/Requests/BatchRequest.cs b/Src/GoogleApis/Apis/Requests/BatchRequest.cs index fa8c1c96db..6d602afdf0 100644 --- a/Src/GoogleApis/Apis/Requests/BatchRequest.cs +++ b/Src/GoogleApis/Apis/Requests/BatchRequest.cs @@ -254,8 +254,13 @@ internal static HttpResponseMessage ParseAsHttpResponse(string content) while (!string.IsNullOrEmpty((line = reader.ReadLine()))) { var separatorIndex = line.IndexOf(':'); - headersDic.Add(line.Substring(0, separatorIndex).Trim(), - line.Substring(separatorIndex + 1).Trim()); + var key = line.Substring(0, separatorIndex).Trim(); + var value = line.Substring(separatorIndex + 1).Trim(); + if (headersDic.ContainsKey(key)) { + headersDic[key] = headersDic[key] + ", " + value; + } else { + headersDic.Add(key, value); + } } // Set the content.