postmanlabs / curl-to-postman

Converts curl requests to Postman Collection v2 request objects
Apache License 2.0
65 stars 31 forks source link

can not parse `Content-Type: application/json;charset=UTF-8` to body json mode #38

Open vikyd opened 3 years ago

vikyd commented 3 years ago

curl :

curl 'http://localhost:9999/myApi' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{"name":"d4"}' \
  --compressed

result:

{
    "result": true,
    "output": [
        {
            "type": "request",
            "data": {
                "method": "POST",
                "name": "http://localhost:9999/myApi",
                "url": "http://localhost:9999/myApi",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json;charset=UTF-8"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\"name\":\"d4\"}"
                },
                "description": "Generated from a curl request: \ncurl 'http://localhost:9999/myApi'   -H 'Content-Type: application/json;charset=UTF-8'   --data-raw '{\\\"name\\\":\\\"d4\\\"}'   --compressed"
            }
        }
    ]
}

want (part) (missing the options):

"body": {
    "mode": "raw",
    "raw": "{\"name\":\"d4\"}",
    "options": {
        "raw": {
            "language": "json"
        }
    }
},