Skip to content

Commit 54ecda9

Browse files
Fixes issue with handling multiple headers with same name in DevToolsPlugin. Closes #1169 (#1170)
1 parent a05e85d commit 54ecda9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dev-proxy-plugins/Inspection/DevToolsPlugin.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ private async Task BeforeRequestAsync(object sender, ProxyRequestArgs e)
231231

232232
var requestId = GetRequestId(e.Session.HttpClient.Request);
233233
var headers = e.Session.HttpClient.Request.Headers
234-
.ToDictionary(h => h.Name, h => h.Value);
234+
.GroupBy(h => h.Name)
235+
.ToDictionary(g => g.Key, g => string.Join(", ", g.Select(h => h.Value)));
235236

236237
var requestWillBeSentMessage = new RequestWillBeSentMessage
237238
{
@@ -314,7 +315,8 @@ private async Task AfterResponseAsync(object sender, ProxyResponseArgs e)
314315
Status = e.Session.HttpClient.Response.StatusCode,
315316
StatusText = e.Session.HttpClient.Response.StatusDescription,
316317
Headers = e.Session.HttpClient.Response.Headers
317-
.ToDictionary(h => h.Name, h => h.Value),
318+
.GroupBy(h => h.Name)
319+
.ToDictionary(g => g.Key, g => string.Join(", ", g.Select(h => h.Value))),
318320
MimeType = e.Session.HttpClient.Response.ContentType
319321
}
320322
}

0 commit comments

Comments
 (0)