Skip to content

Commit f5c689a

Browse files
authored
Add note about default request headers (#12683)
1 parent 918194e commit f5c689a

File tree

8 files changed

+69
-8
lines changed

8 files changed

+69
-8
lines changed

reference/5.1/Microsoft.PowerShell.Utility/Invoke-RestMethod.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 10/29/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -44,6 +44,13 @@ data.
4444
4545
This cmdlet is introduced in Windows PowerShell 3.0. This command can be run using the `irm` alias.
4646

47+
By default, the HTTP request includes default values for the following HTTP headers:
48+
49+
- `Host`
50+
- `User-Agent`
51+
52+
Use the **Headers** parameter to add other headers or override the default values.
53+
4754
## EXAMPLES
4855

4956
### Example 1: Get the PowerShell RSS feed

reference/5.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/16/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -62,6 +62,12 @@ This cmdlet was introduced in Windows PowerShell 3.0.
6262
> For more information about this security update, see
6363
> [PowerShell 5.1: Preventing script execution from web content](https://support.microsoft.com/KB/5074596).
6464
65+
By default, the HTTP request includes default values for the following HTTP headers:
66+
67+
- `Host`
68+
- `User-Agent`
69+
70+
Use the **Headers** parameter to add other headers or override the default values.
6571
6672
This command can be run using the `iwr`, `curl`, or `wget` aliases.
6773

reference/7.4/Microsoft.PowerShell.Utility/Invoke-RestMethod.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -116,6 +116,14 @@ variables. See the [NOTES](#notes) section of this article.
116116
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
117117
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
118118

119+
By default, the HTTP request includes default values for the following HTTP headers:
120+
121+
- `Accept-Encoding`
122+
- `Host`
123+
- `User-Agent`
124+
125+
Use the **Headers** parameter to add other headers or override the default values.
126+
119127
## EXAMPLES
120128

121129
### Example 1: Get the PowerShell RSS feed

reference/7.4/Microsoft.PowerShell.Utility/Invoke-WebRequest.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -105,6 +105,14 @@ variables. See the [Notes](#notes) section of this article.
105105
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
106106
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
107107

108+
By default, the HTTP request includes default values for the following HTTP headers:
109+
110+
- `Accept-Encoding`
111+
- `Host`
112+
- `User-Agent`
113+
114+
Use the **Headers** parameter to add other headers or override the default values.
115+
108116
## EXAMPLES
109117

110118
### Example 1: Send a web request

reference/7.5/Microsoft.PowerShell.Utility/Invoke-RestMethod.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -116,6 +116,14 @@ variables. See the [NOTES](#notes) section of this article.
116116
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
117117
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
118118

119+
By default, the HTTP request includes default values for the following HTTP headers:
120+
121+
- `Accept-Encoding`
122+
- `Host`
123+
- `User-Agent`
124+
125+
Use the **Headers** parameter to add other headers or override the default values.
126+
119127
## EXAMPLES
120128

121129
### Example 1: Get the PowerShell RSS feed

reference/7.5/Microsoft.PowerShell.Utility/Invoke-WebRequest.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -105,6 +105,14 @@ variables. See the [Notes](#notes) section of this article.
105105
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
106106
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
107107

108+
By default, the HTTP request includes default values for the following HTTP headers:
109+
110+
- `Accept-Encoding`
111+
- `Host`
112+
- `User-Agent`
113+
114+
Use the **Headers** parameter to add other headers or override the default values.
115+
108116
## EXAMPLES
109117

110118
### Example 1: Send a web request

reference/7.6/Microsoft.PowerShell.Utility/Invoke-RestMethod.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -116,6 +116,14 @@ variables. See the [NOTES](#notes) section of this article.
116116
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
117117
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
118118

119+
By default, the HTTP request includes default values for the following HTTP headers:
120+
121+
- `Accept-Encoding`
122+
- `Host`
123+
- `User-Agent`
124+
125+
Use the **Headers** parameter to add other headers or override the default values.
126+
119127
## EXAMPLES
120128

121129
### Example 1: Get the PowerShell RSS feed

reference/7.6/Microsoft.PowerShell.Utility/Invoke-WebRequest.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/10/2025
5+
ms.date: 01/20/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -105,6 +105,14 @@ variables. See the [Notes](#notes) section of this article.
105105
Beginning in PowerShell 7.4, character encoding for requests defaults to UTF-8 instead of ASCII. If
106106
you need a different encoding, you must set the `charset` attribute in the `Content-Type` header.
107107

108+
By default, the HTTP request includes default values for the following HTTP headers:
109+
110+
- `Accept-Encoding`
111+
- `Host`
112+
- `User-Agent`
113+
114+
Use the **Headers** parameter to add other headers or override the default values.
115+
108116
## EXAMPLES
109117

110118
### Example 1: Send a web request

0 commit comments

Comments
 (0)