xref: /curl/docs/cmdline-opts/fail-with-body.md (revision e7219c2b)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: fail-with-body
5Protocols: HTTP
6Help: Fail on HTTP errors but save the body
7Category: http output
8Added: 7.76.0
9Mutexed: fail
10Multi: boolean
11See-also:
12  - fail
13  - fail-early
14Example:
15  - --fail-with-body $URL
16---
17
18# `--fail-with-body`
19
20Return an error on server errors where the HTTP response code is 400 or
21greater). In normal cases when an HTTP server fails to deliver a document, it
22returns an HTML document stating so (which often also describes why and more).
23This option allows curl to output and save that content but also to return
24error 22.
25
26This is an alternative option to --fail which makes curl fail for the same
27circumstances but without saving the content.
28