From de404b776ae67124efc81e588199d7b4c2d078df Mon Sep 17 00:00:00 2001 From: bhavishyachandra Date: Fri, 19 Apr 2019 14:32:49 -0400 Subject: [PATCH 1/2] proxy headers --- src/Core/Helpers.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Core/Helpers.cs b/src/Core/Helpers.cs index 321dd9f..d3cbec4 100644 --- a/src/Core/Helpers.cs +++ b/src/Core/Helpers.cs @@ -61,11 +61,12 @@ private static HttpRequestMessage CreateProxyHttpRequest(this HttpContext contex var requestMethod = request.Method; // Copy the request headers. - if (requestMessage.Content != null) + foreach (var header in request.Headers) { - foreach (var header in request.Headers) - if (!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray())) - requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); + if (!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray())) + { + requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); + } } if (!HttpMethods.IsGet(requestMethod) && From 2830a260ebfd6fcfb10c01fda2a13304c0f279f9 Mon Sep 17 00:00:00 2001 From: bhavishyachandra Date: Fri, 19 Apr 2019 14:58:07 -0400 Subject: [PATCH 2/2] removing brackets --- src/Core/Helpers.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Core/Helpers.cs b/src/Core/Helpers.cs index d3cbec4..765fb15 100644 --- a/src/Core/Helpers.cs +++ b/src/Core/Helpers.cs @@ -64,9 +64,7 @@ private static HttpRequestMessage CreateProxyHttpRequest(this HttpContext contex foreach (var header in request.Headers) { if (!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray())) - { requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); - } } if (!HttpMethods.IsGet(requestMethod) &&