cURL / Mailing Lists / curl-users / Single Mail

curl-users

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

From: Alex Bligh <alex_at_alex.org.uk>
Date: Mon, 31 Aug 2015 17:00:53 +0100

Daniel,

On 29 Aug 2015, at 23:08, Daniel Stenberg <daniel_at_haxx.se> wrote:

> I see lots and lots of curl suggestions and examples on the internet use -X where it isn't needed. Like -XGET for an ordinary URL or using -d data -XPOST and so on. Just superfluous uses of -X that annoy me (possibly slightly more than I can really motivate).

Orthogonal point to previous ones.

Whether you do this or not, please could you fix the documentation, as that may be the cause of some of the superfluous usage:

       -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).

       -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.

I don't think that's true either. My understanding is that it will use the method specified by '-X', but changes the default from GET to POST.

-- 
Alex Bligh
-------------------------------------------------------------------
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