Repository navigation
Inconsistent behavior from Invoke-RestMethod from Windows Powershell to Powershell Core #6002
Description
Activity
- changed the title
[-]Inconsistent behavior from Invoke-RestMethod from Powershell to Powershell in Linux[/-][+]Inconsistent behavior from Invoke-RestMethod from Windows Powershell to Powershell Core[/+]on Jan 24, 2018 As far as I can tell, a mimetype consists of a type/subtype. Seems like we have 3 options here:
- keep current behavior and just pass through which may be confusing to users transitioning from Windows PS to PS Core
- error/warning if type is not specified
- if no type specified, automatically prefix with "application/" (not sure how safe/dangerous it would be to do this)
Strict header validation is now default in PS core. This applies to any RFC defined header supplied to
-Headersor-ContentType. One can bypass strict header validation with the-SkipHeaderValidationparameter.https://github.com/PowerShell/PowerShell/blob/master/docs/BREAKINGCHANGES.md#changes-to-web-cmdlets
More info https://get-powershellblog.blogspot.com/2017/11/powershell-core-web-cmdlets-in-depth.html#L08
Reacted by Steve Lee- addedResolution-By DesignThe reported behavior is by design.The reported behavior is by design.
on Jan 24, 2018 - removedResolution-By DesignThe reported behavior is by design.The reported behavior is by design.
on Jan 24, 2018 Actually... there seems to be some odd behavior here. -SkipHeaderValidation doesn't seem to work when
-InFileis used. This is a bug. I'll have to look into it.- addedIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the product
on Jan 24, 2018 After investigating,
-SkipHeaderValidationis not being applied at all to-ContentType. I should have a PR to fix this tomorrow or later today. I have the fix code, just need to write tests.- addedWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesand removed
on Jul 17, 2026
Steps to reproduce
This same code, works in Powershell in Windows, where in Linux doesn't.
Expected behavior
Actual behavior
Environment data