From d036f04b7d1e613efae05216f48534afda626c30 Mon Sep 17 00:00:00 2001 From: cmurialdo Date: Mon, 3 Oct 2022 16:48:49 -0300 Subject: [PATCH] Enable dumping headers and cookies at client.log for .NET --- .../GxClasses/Middleware/GXHttp.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs b/dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs index 8b25e11e1..7c8369154 100644 --- a/dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs +++ b/dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs @@ -1917,8 +1917,19 @@ public void ProcessRequest(HttpContext httpContext) } internal string DumpHeaders(HttpContext httpContext) { -#if !NETCORE StringBuilder str = new StringBuilder(); +#if NETCORE + foreach (string key in httpContext.Request.Headers.Keys) + { + str.Append(key + ":" + httpContext.Request.Headers[key]); + } + str.Append(StringUtil.NewLine() + "HttpCookies: "); + foreach (string key in httpContext.Request.Cookies.Keys) + { + str.Append(StringUtil.NewLine() + key + ":" + httpContext.Request.Cookies[key]); + } + return str.ToString(); +#else foreach (string key in httpContext.Request.Headers) { str.Append(key + ":" + httpContext.Request.Headers[key]); @@ -1929,8 +1940,6 @@ internal string DumpHeaders(HttpContext httpContext) str.Append(StringUtil.NewLine() + key + ":" + httpContext.Request.Cookies[key].Value); } return str.ToString(); -#else - return string.Empty; #endif }