Invoke-RestMethod does not handle http response code 204 correctly - by Dirk-Jan Smits

Status : 


Sign in
to vote
ID 785369 Comments
Status Active Workarounds
Type Bug Repros 2
Opened 4/23/2013 3:12:45 AM
Access Restriction Public



The Invoke-RestMethod keeps waiting for a body, even when the response code is 204 (No Content), after a while a timeout occurs and the statement returns this error:

Invoke-RestMethod : The operation has timed out
At line:83 char:15
Sign in to post a comment.
Posted by Joshua Taliaferro on 5/20/2014 at 9:41 AM
I can confirm that this is an issue on PowerShell 4 using Windows 8.1 x64. The specific REST API I've been working uses the 204 response code to indicate a success that does not require any content to be returned, so this is a game-breaking bug for me. I've had to fall back on Invoke-WebRequest.