Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL snippets fail on Windows due to Single Quote #248

Closed
mzhukovs opened this issue May 17, 2020 · 2 comments · Fixed by #448
Closed

cURL snippets fail on Windows due to Single Quote #248

mzhukovs opened this issue May 17, 2020 · 2 comments · Fixed by #448

Comments

@mzhukovs
Copy link

Describe the bug
@umeshp7 @shreys7
#72 #92
this causes a problem on Windows machines; by pasting the cURL generated code snipped into a Windows Command Prompt, you get the misleading error message:

curl: (1) Protocol "'https" not supported or disabled in libcurl

Which is just due to the single quotes, and can be fixed only by using double quotes.

see here: https://stackoverflow.com/questions/6884669/curl-1-protocol-https-not-supported-or-disabled-in-libcurl

Much like you have the option to change the line continuation character from \ to ^ in the Settings there, I think the single vs. double quote should also be an option.

As a bonus, would be nice if Postman detected that the machine is Windows and defaulted to ^ and " in the settings accordingly.

To Reproduce
Paste any resulting cURL snippet into a win cmd prompt

@someshkoli
Copy link
Contributor

@umeshp7 the line breaker option is available in the options but i guess is not set in the postmanapp.
image

@JannemanDev
Copy link

JannemanDev commented Jan 3, 2021

This is generated by Postman using cURL but still causes trouble:
curl -L -X POST "https://localhost:5443/connect/token" -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=m2m.client' --data-urlencode 'scope=weatherapi.read' --data-urlencode 'client_secret=SuperSecretPassword' --data-urlencode 'grant_type=client_credentials'

should be

curl -L -XPOST "https://localhost:5443/connect/token" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "client_id=m2m.client&scope=weatherapi.read&client_secret=SuperSecretPassword&grant_type=client_credentials"

Notice the removal of the space between -X and POST! Also the data needs double quotes.

Here's another example generated by cURL:
curl -L -X GET "https://localhost:5445/WeatherForecast" -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjlCMTQ3MUM0MDI4MUVDMDdBMU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YI3HXCNl4Ov8-SjBXp9VftxfBZ4ZiHojMbBaNsH0y5ol2wc-ZsY3ua97m0XWmiiP3BZgJYN7hz8_gvpI03NXTgSIbMPxN7zubyiYQZ2XRjUZTukCevAjBvcPimqxBoJ4lC1UzbGnK-VjIdPWGKeSf3MOcQRl2K0Trw66qXqmjAkYC7K4t_qWw7p5UNY7QPY0t872YaaRLNlnqQnJBMbVhs9HESsk1reF3HQ8Oi-HwD5ikty9fhBK61h409RPeNljeW4dTxCSPU3AetA13VFSSL_M0ONqhpyE7pjrd1ghNMF0tOC1pqRSrQzOd7VBtscaMAAEupuNRzu_r-qIK4ROxw"

My settings were:
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment