What are the dedicated command line options for `curl -X`?

In my curl man pages:

-X, --request (...) Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.

What are the dedicated command line options for curl -X?

For example, what is the alternative to curl -X POST?

1 Answer

When doing HTTP with curl, the -X option changes the actual method string in the HTTP request. That’s all it does - changes one word in the request header.

It’s useful when you want to send a DELETE method or TRACE or similar that curl has no native support for, for example a custom FTP command to use instead of the default LIST command.

It does not change the behavior of curl in any other way, which makes it possible to royally confuse curl and even cause timeouts.

It's very easy to misuse. For example, curl -X HEAD does not give any output because, by default, curl does not print headers if the switch -i is not specified.

Useful reference : Unnecessary use of curl -X.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like