leoek / fetch-to-curl

Convert javascript fetch requests to curl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing single quote escaping

electerious opened this issue · comments

My fetch request has body with a JSON that contains single quotes:

{"example":"Example with 'single quotes'"}

This turns into a curl like this:

curl 'http://localhost:8090/v1/api' -X POST -H "Content-Type: application/json" --data-binary '{"example":"Example with 'single quotes'"}

The single quotes however need to be escaped, because the data-binary is already wrapped in single quotes. The correct way to do so is with '\''.

curl 'http://localhost:8090/v1/previews/dataSets' -X POST -H "Content-Type: application/json" --data-binary '{"example":"Example with '\''single quotes'\''"}

More details: https://stackoverflow.com/a/61891335


Thanks a lot for this great module! It makes debugging in our project so much easier.

fixed by #45

Thanks @leoek! Can you release a new version that contains the fix?

Hi @electerious sorry for the late release but it is now live: 0.6.0