I am trying to invoke a web request which will print out a stream of plain-text live. It currently works, but doesn't produce any output until the request is complete. I'm trying to find a way to see the content as soon as comes down the wire. I can currently do with with a curl command from a Linux box and it shows be each line of output as soon as it's produced. The PowerShell command I'm trying to use it something like this:
Invoke-WebRequest -Body @{id=123} -Method POST -Uri http://server/run_command/
The corresponding curl command on Linux is:
curl -d id=123 -X POST http://server/run_command/ --no-buffer
The --no-buffer
option is only needed when sending the output to another command like grep. How can I accomplish this using just PowerShell?
I am not able to test this myself right now, but have you tried expanding the content?
(Invoke-WebRequest -Body @{id=123} -Method POST -Uri http://server/run_command/).Content
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With