Using PowerShell 5, I'm downloading from a REST endpoint by doing:
$result = Invoke-RestMethod -Method Get -Uri "http://example.com/endpoint/item"
The result is 4Mb+ in size aprox. And sometimes $result
is not a PSObject
as I expect, but a string, which contains an incomplete JSON response.
So somehow I suspect there is a timeout, or something going on. But if that is the thing, then i tried using the TimeoutSec
parameter with a very large number, like this:
$result = Invoke-RestMethod -Method Get -Uri "http://example.com/endpoint/item" -TimeoutSec 10000
I had no luck: the response is broken (missing part on the JSON string).
Anyway, if there is a timeout involved, should'nt it throw an error?
Also, may be the problem is not on client side, but server side? I'm confused on which side is responsible here.