Comment

Comment by ta0967

do not use -X without having read the manual, it can break redirects and other things.

from the curl(1) manpage:

       -X, --request <command>

              (...)

              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.

              This  option  only  changes the actual word used in the HTTP request, it does not alter the way
              curl behaves. So for example if you want to make a proper HEAD request, using -X HEAD will  not
              suffice. You need to use the -I, --head option.

              The  method  string you set with -X will be used for all requests, which if you for example use
              -L, --location may cause unintended  side-effects  when  curl  doesn't  change  request  method
              according to the HTTP 30x response codes - and similar.
PUT is indicated by using -T / --upload-file, POST by -d / --data or any --data-foo option (eg. --data-raw). DELETE is the only HTTP method in the parent list that needs -X to be used.
parent ta0967 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton