Skip to content

Invoke-RestMethod does not count on Content-Type field. Broken compared to PS 5.0. #2245

@sitano

Description

@sitano

Steps to reproduce

$ Invoke-RestMethod -Uri https://httpbin.org/robots.txt                                             

Expected behavior

Return content. Or at least behave the same as in PowerShell 5.0.

Actual behavior

Invoke-RestMethod : Unexpected character encountered while parsing value: U. Path '', line 0, position 0.
At line:1 char:1

  • Invoke-RestMethod -Uri https://httpbin.org/robots.txt
  • - CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], JsonReaderException
    - FullyQualifiedErrorId : Newtonsoft.Json.JsonReaderException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    

Environment data

> $PSVersionTable
Name                           Value                                                                                                                                                                              
----                           -----                                                                                                                                                                              
PSVersion                      6.0.0-alpha                                                                                                                                                                        
PSEdition                      Core                                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                            
BuildVersion                   3.0.0.0                                                                                                                                                                            
GitCommitId                    v6.0.0-alpha.9                                                                                                                                                                     
CLRVersion                                                                                                                                                                                                        
WSManStackVersion              3.0                                                                                                                                                                                
PSRemotingProtocolVersion      2.3                                                                                                                                                                                
SerializationVersion           1.1.0.1

powershell 6.0.0-alpha.9-1

Metadata

Metadata

Assignees

Labels

WG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions