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);