-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
I did this
I was debating about whether to file this as a bug on curl or wcurl. Ultimately I think the root cause is poor option handing in the curl command line.
I recently updated my $HOME/.curlrc file to include the newish fail-with-body option. Maybe this isn't recommended, but it seemed like a better default. I sometimes use the curl command to interactively test web APIs so seeing failure bodies is nice.
I forgot about this for a long time but then I found that wcurl was failing in a weird way:
$ wcurl https://curl.se/docs/projdocs.html
curl: option --fail: is badly used here
curl: try 'curl --help' or 'curl --manual' for more informationOf course the problem was obvious once I remembered the .curlrc change, but it took some investigation first.
I expected the following
I think there are a couple things that could be improved.
First, the error message "--fail: is badly used here" wasn't very helpful. If it has said something like "--fail cannot be combined with --fail-with-body" I probably would have diagnosed the problem quicker.
Second, if the flags are to be mutually exclusive then that should probably only apply when they're both specified in the same place. It seems reasonable that curl disallows curl --fail-with-body --fail, but it also seems that --fail on the command line should just override fail-with-body in $HOME/.curlrc without complaint. Otherwise it is impossible to use either --fail option in a script without risking breakage from curlrc.
curl/libcurl version
curl 8.16.0
operating system
MacOS 26.0.1 + curl from Homebrew