Repository: PowerShell/PowerShell
File: src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs (C#)

Code before:
                }
            }
        }

        internal virtual HttpResponseMessage GetResponse(HttpClient client, HttpRequestMessage request, bool handleRedirect)
        {
            ArgumentNullException.ThrowIfNull(client);
            ArgumentNullException.ThrowIfNull(request);

            // Add 1 to account for the first request.
            int totalRequests = WebSession.MaximumRetryCount + 1;
            HttpRequestMessage currentRequest = request;
            HttpResponseMessage response = null;

            do
            {
                // Track the current URI being used by various requests and re-requests.
                Uri currentUri = currentRequest.RequestUri;

                _cancelToken = new CancellationTokenSource();
                try
                {
                    if (IsWriteVerboseEnabled())
                    {
                        WriteWebRequestVerboseInfo(request);
                    }
                    if (IsWriteDebugEnabled())
                    {
                        WriteWebRequestDebugInfo(request);
                    }

                    response = client.SendAsync(currentRequest, HttpCompletionOption.ResponseHeadersRead, _cancelToken.Token).GetAwaiter().GetResult();

                    if (IsWriteVerboseEnabled())
                    {
                        WriteWebResponseVerboseInfo(response);
                    }
                    if (IsWriteDebugEnabled())
                    {
                        WriteWebResponseDebugInfo(response);
                    }
                }
                catch (TaskCanceledException ex)
                {
                    if (ex.InnerException is TimeoutException)
                    {
                        // HTTP Request timed out
                        ErrorRecord er = new(ex, "ConnectionTimeoutReached", ErrorCategory.OperationTimeout, null);
                        ThrowTerminatingError(er);
                    }
                    else

Review comment (suggestion):
```suggestion
                    if (IsWriteVerboseEnabled())
                    {
                        WriteWebRequestVerboseInfo(request);
                    }

```

Code after:
                }
            }
        }

        internal virtual HttpResponseMessage GetResponse(HttpClient client, HttpRequestMessage request, bool handleRedirect)
        {
            ArgumentNullException.ThrowIfNull(client);
            ArgumentNullException.ThrowIfNull(request);

            // Add 1 to account for the first request.
            int totalRequests = WebSession.MaximumRetryCount + 1;
            HttpRequestMessage currentRequest = request;
            HttpResponseMessage response = null;

            do
            {
                // Track the current URI being used by various requests and re-requests.
                Uri currentUri = currentRequest.RequestUri;

                _cancelToken = new CancellationTokenSource();
                try
                {
                    if (IsWriteVerboseEnabled())
                    {
                        WriteWebRequestVerboseInfo(currentRequest);
                    }

                    if (IsWriteDebugEnabled())
                    {
                        WriteWebRequestDebugInfo(currentRequest);
                    }

                    response = client.SendAsync(currentRequest, HttpCompletionOption.ResponseHeadersRead, _cancelToken.Token).GetAwaiter().GetResult();

                    if (IsWriteVerboseEnabled())
                    {
                        WriteWebResponseVerboseInfo(response);
                    }

                    if (IsWriteDebugEnabled())
                    {
                        WriteWebResponseDebugInfo(response);
                    }
                }
                catch (TaskCanceledException ex)
                {
                    if (ex.InnerException is TimeoutException)
                    {
                        // HTTP Request timed out
                        ErrorRecord er = new(ex, "ConnectionTimeoutReached", ErrorCategory.OperationTimeout, null);
                        ThrowTerminatingError(er);