Could not resolve host on Windows machine for curl call

Today I got a curl snippet, which was built initially in Linux. I copied it and put it into my Cmder console. Then I was a little bit surprised about the upcoming errors:

curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (1) Protocol "'https" not supported or disabled in libcurl

I took a second look into the curl command and I was wondering why the curl was throwing the error messages:

curl -X POST -k -H 'Accept: application/json' -H 'Content-type: application/json' -i '' --data '{"foo":"bar"}'

After a short search, I could do the call without any issues. The space between Accept: and application in the header information are causing the first two error messages. The last error could be fixed by using double quotation marks instead of a single quotation mark. The working curl call for windows:

// working curl call in windows
// remove white space in the header information
// change url quotations from single to double 

curl -X POST -k -H 'Accept:application/json' -H 'Content-type:application/json' -i "" --data '{"foo":"bar"}'

Both curl calls are working in Linux, but the second is working in Windows, only. What issues do you have experienced with curl calls in Windows?


Join the conversation

comment 1 comment
  • Shreyas

    Thank you so much, this resolved my issue. In windows we need to use double quotes instead of single.. wow

Leave a comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.