curlconverter / curlconverter

Transpile curl commands into Python, JavaScript and 27 other languages
https://curlconverter.com
MIT License
7.17k stars 867 forks source link

Support for multiline curl commands? #598

Closed daddy32 closed 6 months ago

daddy32 commented 6 months ago

Sometimes, for the sake of the readability, we split the curl command into multiple lines: Linux format:

curl --request POST \
  --url https://www.example.com \
  --header "Content-Type: application/x-www-form-urlencoded" \
...

Windows format:

curl --request POST ^
  --url https://www.example.com ^
  --header "Content-Type: application/x-www-form-urlencoded" ^
...

This tool does not like that :)

Error: command should begin with "curl" but instead begins with "--url"

I'm not sure if this is in the scope of the project, but if it aims to support generic curl format, then it also includes this.

verhovsky commented 6 months ago

This is already supported, try pasting your linux example into the tool. Your issue is that "Windows format" (with ^ as the escape character) is not supported, see #143

daddy32 commented 6 months ago

I would swear I got the error for Linux syntax too, but can't reproduce it now. So: OK.