Skip to content

Commit 7da23e5

Browse files
(GH-10801) Fix -OutFile for web request cmdlets (#10804)
Prior to this change, the documentation for the `-OutFile` parameter of the `Invoke-WebRequest` cmdlet incorrectly mentioned retrieving the filename from the Content-Disposition. This functionality isn't implemented. Further, the `-OutFile` parameter for `Invoke-RestMethod` is missing any version-specific note, even though the behavior is the same. This change: - Fixes the wording for the `-OutFile` parameter in `Invoke-WebRequest` to remove the non-implemented detail. - Adds a note to the documentation for `Invoke-RestMethod` about the automatic naming. - Resolves #10801 - Fixes AB#200725
1 parent dd6931a commit 7da23e5

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

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

Lines changed: 6 additions & 2 deletions
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: 01/03/2024
5+
ms.date: 01/17/2024
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
title: Invoke-RestMethod
@@ -888,12 +888,16 @@ Accept wildcard characters: False
888888

889889
### -OutFile
890890

891-
Saves the response body in the specified output file. Enter a path and file name. If you omit the
891+
Saves the response body in the specified output file. Enter a path and filename. If you omit the
892892
path, the default is the current location. The name is treated as a literal path. Names that contain
893893
brackets (`[]`) must be enclosed in single quotes (`'`).
894894

895895
By default, `Invoke-RestMethod` returns the results to the pipeline.
896896

897+
Starting in PowerShell 7.4, you can specify a folder path without the filename. When you do, the
898+
file's name is the taken from the last segment of the resolved URI after any redirections. When you
899+
specify a folder path for **OutFile**, you can't use the **Resume** parameter.
900+
897901
```yaml
898902
Type: System.String
899903
Parameter Sets: (All)

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

Lines changed: 3 additions & 5 deletions
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: 01/03/2024
5+
ms.date: 01/17/2024
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
title: Invoke-WebRequest
@@ -921,10 +921,8 @@ By default, `Invoke-WebRequest` returns the results to the pipeline. To send the
921921
and to the pipeline, use the **Passthru** parameter.
922922

923923
Starting in PowerShell 7.4, you can specify a folder path without the filename. When you do, the
924-
file's name is the taken from either the
925-
[Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)
926-
of the response or the last segment of the resolved URI after any redirections. When you specify a
927-
folder path for **OutFile**, you can't use the **Resume** parameter.
924+
file's name is the taken from the last segment of the resolved URI after any redirections. When you
925+
specify a folder path for **OutFile**, you can't use the **Resume** parameter.
928926

929927
```yaml
930928
Type: System.String

0 commit comments

Comments
 (0)