We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$resp = $_.Exception.Response.GetResponseStream() this line causes a problem as GetResponseStream() seems to be deprecated since powershell v6+.
$resp = $_.Exception.Response.GetResponseStream()
I ran into this error with the latest powershell v7. A possible fix would be a wrapper like this one here: https://stackoverflow.com/a/48154663/16052146
if ($PSVersionTable.PSVersion.Major -lt 6) { if ($Error.Exception.Response) { $Reader = New-Object System.IO.StreamReader($Error.Exception.Response.GetResponseStream()) $Reader.BaseStream.Position = 0 $Reader.DiscardBufferedData() $ResponseBody = $Reader.ReadToEnd() if ($ResponseBody.StartsWith('{')) { $ResponseBody = $ResponseBody | ConvertFrom-Json } return $ResponseBody } } else { return $Error.ErrorDetails.Message } } try { $result = Invoke-WebRequest ... } catch { ParseErrorForResponseBody($_) }
Tried it out but it then breaks
710 | $reader = New-Object System.IO.StreamReader($resp)
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
@5M7X Have you retrieved any workaround in the meantime? Currently, facing the same issue.
No branches or pull requests
$resp = $_.Exception.Response.GetResponseStream()
this line causes a problem as GetResponseStream() seems to be deprecated since powershell v6+.I ran into this error with the latest powershell v7.
A possible fix would be a wrapper like this one here: https://stackoverflow.com/a/48154663/16052146
Tried it out but it then breaks
710 | $reader = New-Object System.IO.StreamReader($resp)
The text was updated successfully, but these errors were encountered: