cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: A small nudge to fix a frequent -X misuse?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 31 Aug 2015 22:46:59 +0200 (CEST)

On Mon, 31 Aug 2015, Alex Bligh wrote:

> -X, --request <command>
> (HTTP) Specifies a custom request method to use when communicat‐
> ing with the HTTP server. The specified request will be used
> instead of the method otherwise used (which defaults to GET).
>
> That's not true. It defaults to 'GET' unless '-d' is used, in which case it
> defaults to 'POST' (AIUI).

I disagree.

GET is the default. You can then change the method away from the default to
other methods. Like -d makes it a POST, -I makes it a HEAD and -T makes it a
PUT. It still makes GET the default. What you get unless you ask for something
else.

Default as defined as "a preselected option". There is only one default
method.

> -d, --data <data>
> (HTTP) Sends the specified data in a POST request to the HTTP
> server, in the same way that a browser does when a user has
> filled in an HTML form and presses the submit button.
>

> My understanding is that it will use the method specified by '-X', but
> changes the default from GET to POST.

-X changes the method string to use in the requeste, but how do you suggest we
should phrase the -d, --data description to take that into account without
making it some completely messed up? All logic and internals still acts the
same as with a POST (request + body) even if you change the method.

-X changes the method for any curl command line, but I'm not sure we need to
add that for the descriptions of all of them. But of course, I'm always open
to improve the wording if you can suggest a new one we think sounds better or
explains the situation better to users.

(And it doesn't change the default. It changes the method _from_ the default
to POST...)

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-08-31