1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Long: fail 5Short: f 6Protocols: HTTP 7Help: Fail fast with no output on HTTP errors 8Category: important http 9Mutexed: fail-with-body 10Added: 4.0 11Multi: boolean 12See-also: 13 - fail-with-body 14 - fail-early 15Example: 16 - --fail $URL 17--- 18 19# `--fail` 20 21Fail with error code 22 and with no response body output at all for HTTP 22transfers returning HTTP response codes at 400 or greater. 23 24In normal cases when an HTTP server fails to deliver a document, it returns a 25body of text stating so (which often also describes why and more) and a 4xx 26HTTP response code. This command line option prevents curl from outputting 27that data and instead returns error 22 early. By default, curl does not 28consider HTTP response codes to indicate failure. 29 30To get both the error code and also save the content, use --fail-with-body 31instead. 32 33This method is not fail-safe and there are occasions where non-successful 34response codes slip through, especially when authentication is involved 35(response codes 401 and 407). 36