From 0b078175da2564d8fd9b47f3fc6c8a089b582089 Mon Sep 17 00:00:00 2001
From: CarloToso <105941898+CarloToso@users.noreply.github.com>
Date: Tue, 9 May 2023 01:00:04 +0200
Subject: [PATCH] Improve the verbose message of WebCmdlets to show correct
HTTP version (#19616)
---
.../utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs | 4 ++--
.../resources/WebCmdletStrings.resx | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
index 7a53e22f6a..ce878c1677 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
@@ -568,8 +568,8 @@ namespace Microsoft.PowerShell.Commands
string contentType = ContentHelper.GetContentType(response);
long? contentLength = response.Content.Headers.ContentLength;
string respVerboseMsg = contentLength is null
- ? string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.WebResponseNoSizeVerboseMsg, contentType)
- : string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.WebResponseVerboseMsg, contentLength, contentType);
+ ? string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.WebResponseNoSizeVerboseMsg, response.Version, contentType)
+ : string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.WebResponseVerboseMsg, response.Version, contentLength, contentType);
WriteVerbose(respVerboseMsg);
diff --git a/src/Microsoft.PowerShell.Commands.Utility/resources/WebCmdletStrings.resx b/src/Microsoft.PowerShell.Commands.Utility/resources/WebCmdletStrings.resx
index 4236ba8079..6e73043747 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/resources/WebCmdletStrings.resx
+++ b/src/Microsoft.PowerShell.Commands.Utility/resources/WebCmdletStrings.resx
@@ -235,16 +235,16 @@
Following rel link {0}
- HTTP/{0} {1} with {2}-byte payload
+ Requested HTTP/{0} {1} with {2}-byte payload
The remote server indicated it could not resume downloading. The local file will be overwritten.
- received {0}-byte response of content type {1}
+ Received HTTP/{0} {1}-byte response of content type {2}
- received response of content type {0} of unknown size
+ Received HTTP/{0} response of content type {1} of unknown size
Retrying after interval of {0} seconds. Status code for previous attempt: {1}