node-js-libs / curlrequest

A cURL wrapper
MIT License
184 stars 44 forks source link

--request "VERB" is insufficient for certain HTTP methods (head) #52

Closed gyula-ny closed 7 years ago

gyula-ny commented 7 years ago

Hi,

as I see the http method is specified with the "--request" curl option - which, however, doesn't work with e.g. "head" requests. As the curl(1) manpage says about --request/-X

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

Also: "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."

chriso commented 7 years ago

Try passing {url: <url>, head: true} instead of {url: <url>, method: 'HEAD'}.