tool_getparam: make --fail and --fail-with-body override each other

This allows users to put one of them in their .curlrc and still easily use the
other one at will in command lines.

Reported-by: Mitchell Blank Jr
Fixes #19029
This commit is contained in:
Daniel Stenberg 2025-10-12 15:58:43 +02:00
parent 56450ce26f
commit 12a702814f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2040,9 +2040,8 @@ static ParameterError opt_bool(struct OperationConfig *config,
case C_FAIL_WITH_BODY: /* --fail-with-body */
config->failwithbody = toggle;
if(config->failonerror && config->failwithbody) {
errorf("You must select either --fail or "
"--fail-with-body, not both.");
return PARAM_BAD_USE;
warnf("--fail-with-body deselects --fail here");
config->failonerror = FALSE;
}
break;
case C_REMOVE_ON_ERROR: /* --remove-on-error */
@ -2055,9 +2054,8 @@ static ParameterError opt_bool(struct OperationConfig *config,
case C_FAIL: /* --fail */
config->failonerror = toggle;
if(config->failonerror && config->failwithbody) {
errorf("You must select either --fail or "
"--fail-with-body, not both.");
return PARAM_BAD_USE;
warnf("--fail deselects --fail-with-body here");
config->failwithbody = FALSE;
}
break;
case C_GLOBOFF: /* --globoff */