I need a Linux command to launch an HTTP request, and:
- dump the HTTP response (content, not headers) on the terminal standard output
- return an command error status of 0 if the request went well (ended up with HTTP code 200 OK), and non-zero in all other cases (404, 500, connection failed, etc)
Gratis, needs to work on most Linux distributions, bonus for Mac.
curl does not seem to be able to do that, as its --fail
switch prevents HTTP output.
cat
the file andrc=0
, or simplyrc>0
otherwise)?$HEADERS
when done, or after a while you've got plenty of temp files :)