-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Problem description
In Invoke-RestMethod
, the PassThru parameter must be used with the OutFile parameter. The intent is that you can write the results to the file and get the output to the pipeline. But the cmdlets only write to the pipeline, not the file.
The problem code starts here:
Line 387 in 38d582f
if (ShouldWriteToPipeline) |
if (ShouldWriteToPipeline)
{
...
}
else if (ShouldSaveToOutFile)
{
...
}
Notice that the logic outputs pipeline and skips the output to the file. Both ShouldWriteToPipeline
and ShouldSaveToOutFile
can be true so need to remove the else
.
Steps to reproduce
Invoke-RestMethod https://taxonomyservice.azurefd.net/taxonomies/product-uri -PassThru -OutFile C:\temp\irm.json
Expected behavior
Output to console and to the file.
Actual behavior
Output to console only. The output file is not created.
Environment data
This affects all versions 5.1 and higher.
vexx32, smarkwell, rjk and mklement0
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module