From aba09e486d3c4f348a0a653d95b5bc94304c5587 Mon Sep 17 00:00:00 2001
From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com>
Date: Sun, 23 Jun 2024 18:47:18 +0300
Subject: [PATCH] [dotnet] Kick off sending of request and log it in parallel
---
dotnet/src/webdriver/Remote/HttpCommandExecutor.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
index 5256cc7b57606..9abd3d60d7ee3 100644
--- a/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
+++ b/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
@@ -414,6 +414,8 @@ public DiagnosticsHttpHandler(HttpMessageHandler messageHandler, ILogger logger)
/// The http response message content.
protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
+ var responseTask = base.SendAsync(request, cancellationToken);
+
StringBuilder requestLogMessageBuilder = new();
requestLogMessageBuilder.AppendFormat(">> {0}", request);
@@ -423,11 +425,9 @@ protected override async Task SendAsync(HttpRequestMessage
requestLogMessageBuilder.AppendFormat("{0}{1}", Environment.NewLine, requestContent);
}
- var responseTask = base.SendAsync(request, cancellationToken).ConfigureAwait(false);
-
_logger.Trace(requestLogMessageBuilder.ToString());
- var response = await responseTask;
+ var response = await responseTask.ConfigureAwait(false);
StringBuilder responseLogMessageBuilder = new();
responseLogMessageBuilder.AppendFormat("<< {0}", response);