Skip to content

Commit

Permalink
Enable dumping headers and cookies at client.log for .NET
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiamurialdo committed Oct 3, 2022
1 parent b38d4ce commit d036f04
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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
}

Expand Down

0 comments on commit d036f04

Please sign in to comment.