fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Fix: Body quotes not escaped

Open cuamckuu opened this issue 3 years ago • 1 comments

Hi, thanks for the app, it's usefull for converting curl API examples to JS code.

Also here is a problem

With input:

curl -X POST 'URL' -H 'Content-Type: application/json' --data '{"name": "Felix", "color": "black"}'

Output is:

fetch("https://URL", {
  body: "{"name": "Felix", "color": "black"}",
  headers: {
    "Content-Type": "application/json"
  },
  method: "POST"
})

Take look at body, probably it should be something like: body: "{\"name\": \"Felix\", \"color\": \"black\"}"

cuamckuu avatar Apr 22 '22 10:04 cuamckuu

@cuamckuu thank you for the clear issue, will look into it !

kigiri avatar Apr 26 '22 18:04 kigiri