[curl] Treat an HTTP error response as a failed command

Created on November 30, 2026

Use -f or --fail in scripts where an HTTP error should make curl exit unsuccessfully.

curl --fail https://example.com/not-found

For an HTTP error such as 404, curl suppresses the response body and exits with status 22.

Reference

Shell command curl