xref: /aosp_15_r20/external/curl/docs/cmdline-opts/fail-with-body.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: fail-with-body
5*6236dae4SAndroid Build Coastguard WorkerProtocols: HTTP
6*6236dae4SAndroid Build Coastguard WorkerHelp: Fail on HTTP errors but save the body
7*6236dae4SAndroid Build Coastguard WorkerCategory: http output
8*6236dae4SAndroid Build Coastguard WorkerAdded: 7.76.0
9*6236dae4SAndroid Build Coastguard WorkerMutexed: fail
10*6236dae4SAndroid Build Coastguard WorkerMulti: boolean
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - fail
13*6236dae4SAndroid Build Coastguard Worker  - fail-early
14*6236dae4SAndroid Build Coastguard WorkerExample:
15*6236dae4SAndroid Build Coastguard Worker  - --fail-with-body $URL
16*6236dae4SAndroid Build Coastguard Worker---
17*6236dae4SAndroid Build Coastguard Worker
18*6236dae4SAndroid Build Coastguard Worker# `--fail-with-body`
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard WorkerReturn an error on server errors where the HTTP response code is 400 or
21*6236dae4SAndroid Build Coastguard Workergreater). In normal cases when an HTTP server fails to deliver a document, it
22*6236dae4SAndroid Build Coastguard Workerreturns an HTML document stating so (which often also describes why and more).
23*6236dae4SAndroid Build Coastguard WorkerThis option allows curl to output and save that content but also to return
24*6236dae4SAndroid Build Coastguard Workererror 22.
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerThis is an alternative option to --fail which makes curl fail for the same
27*6236dae4SAndroid Build Coastguard Workercircumstances but without saving the content.
28