json
json copied to clipboard
`-E | --http-error` option to control the exit value based on HTTP headers
A common pattern is to pipe HTTP responses through json
. The problem here is that it
makes it hard to recognize errors in the response (e.g. 5xx response status codes) in scripting this... because the pipe through json
looses the exit status. That is unless set -o pipefail
is also used in the script... and something saner than curl
is used (curl has no way to get the output and have a non-zero exit status per the HTTP response code).
WOuld need to clarify exactly which HTTP codes should translate to exit status errors.