From 44bf8cd3b906be19b1b65d2d2399937bf25455df Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 28 Sep 2024 22:26:21 +0300 Subject: [PATCH 1/3] [dotnet] Don't include http headers in internal logs --- dotnet/src/webdriver/Remote/HttpCommandExecutor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs index f529b2aa0dbf1..ea90b38dce920 100644 --- a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs +++ b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; @@ -417,7 +418,7 @@ protected override async Task SendAsync(HttpRequestMessage var responseTask = base.SendAsync(request, cancellationToken); StringBuilder requestLogMessageBuilder = new(); - requestLogMessageBuilder.AppendFormat(">> {0}", request); + requestLogMessageBuilder.AppendFormat(">> {0} RequestUri: {1}, Content: {2}, Headers: {3}", request.Method, request.RequestUri, request.Content, request.Headers?.Count()); if (request.Content != null) { @@ -430,7 +431,7 @@ protected override async Task SendAsync(HttpRequestMessage var response = await responseTask.ConfigureAwait(false); StringBuilder responseLogMessageBuilder = new(); - responseLogMessageBuilder.AppendFormat("<< {0}", response); + responseLogMessageBuilder.AppendFormat("<< StatusCodde: {0}, ReasonPhrase: {1}, Content: {2}, Headers: {3}", (int)response.StatusCode, response.ReasonPhrase, response.Content, response.Headers?.Count()); if (!response.IsSuccessStatusCode && response.Content != null) { From 4c3b2baf5aae7c45916bea24da0b30cac1a8b59c Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 28 Sep 2024 23:33:02 +0300 Subject: [PATCH 2/3] Update dotnet/src/webdriver/Remote/HttpCommandExecutor.cs Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> --- dotnet/src/webdriver/Remote/HttpCommandExecutor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs index ea90b38dce920..51c6ca7847e7b 100644 --- a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs +++ b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs @@ -431,7 +431,7 @@ protected override async Task SendAsync(HttpRequestMessage var response = await responseTask.ConfigureAwait(false); StringBuilder responseLogMessageBuilder = new(); - responseLogMessageBuilder.AppendFormat("<< StatusCodde: {0}, ReasonPhrase: {1}, Content: {2}, Headers: {3}", (int)response.StatusCode, response.ReasonPhrase, response.Content, response.Headers?.Count()); + responseLogMessageBuilder.AppendFormat("<< StatusCode: {0}, ReasonPhrase: {1}, Content: {2}, Headers: {3}", (int)response.StatusCode, response.ReasonPhrase, response.Content, response.Headers?.Count()); if (!response.IsSuccessStatusCode && response.Content != null) { From 063cf0f6e82d0a3879d75ebc1b4684054ea03ab6 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 28 Sep 2024 23:37:41 +0300 Subject: [PATCH 3/3] Update dotnet/src/webdriver/Remote/HttpCommandExecutor.cs Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> --- dotnet/src/webdriver/Remote/HttpCommandExecutor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs index 51c6ca7847e7b..251c6bca78fe1 100644 --- a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs +++ b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs @@ -418,7 +418,11 @@ protected override async Task SendAsync(HttpRequestMessage var responseTask = base.SendAsync(request, cancellationToken); StringBuilder requestLogMessageBuilder = new(); - requestLogMessageBuilder.AppendFormat(">> {0} RequestUri: {1}, Content: {2}, Headers: {3}", request.Method, request.RequestUri, request.Content, request.Headers?.Count()); + requestLogMessageBuilder.AppendFormat(">> {0} RequestUri: {1}, Content: {2}, Headers: {3}", + request.Method, + request.RequestUri?.ToString() ?? "null", + request.Content?.ToString() ?? "null", + request.Headers?.Count()); if (request.Content != null) {