Skip to content
This repository was archived by the owner on Apr 17, 2024. It is now read-only.
This repository was archived by the owner on Apr 17, 2024. It is now read-only.

Feature request: generate curl command with quotes instead of backslashes #288

@jjnilton

Description

@jjnilton

Request block:

POST https://example.com
Content-Type: application/json
{
    "order_ref": "12321312",
    "total": 123,
    "items": [
        {
            "item_title": "Payment Test in Digital Wallet",
            "unit_price": 123,
            "quantity": 1
        }
    ],
    "buyer": {
        "name": "Foo bar",
        "personId": "123",
        "phone": "123"
    },
    "callback_url": "https:\/\/example.com\/example\/example\/v1\/example\/example\/example\/123"
}

Current curl command from the block above:

curl -i -H Content-Type\:\ application/json -XPOST https\://example.com -d \{'
'\ \ \ \ \"order_ref\"\:\ \"12321312\"\,'
'\ \ \ \ \"total\"\:\ 123\,'
'\ \ \ \ \"items\"\:\ \['
'\ \ \ \ \ \ \ \ \{'
'\ \ \ \ \ \ \ \ \ \ \ \ \"item_title\"\:\ \"Payment\ Test\ in\ Digital\ Wallet\"\,'
'\ \ \ \ \ \ \ \ \ \ \ \ \"unit_price\"\:\ 123\,'
'\ \ \ \ \ \ \ \ \ \ \ \ \"quantity\"\:\ 1'
'\ \ \ \ \ \ \ \ \}'
'\ \ \ \ \]\,'
'\ \ \ \ \"buyer\"\:\ \{'
'\ \ \ \ \ \ \ \ \"name\"\:\ \"Foo\ bar\"\,\ '
'\ \ \ \ \ \ \ \ \"personId\"\:\ \"123\"\,'
'\ \ \ \ \ \ \ \ \"phone\"\:\ \"123\"'
'\ \ \ \ \}\,'
'\ \ \ \ \"callback_url\"\:\ \"https\:\\/\\/example.com\\/example\\/example\\/v1\\/example\\/example\\/example\\/123\"'
'\}'
'

Suggested curl command output:

curl -i -H "Content-Type: application/json" -XPOST https://example.com -d '{
    "order_ref": "12321312",
    "total": 123,
    "items": [
        {
            "item_title": "Payment Test in Digital Wallet",
            "unit_price": 123,
            "quantity": 1
        }
    ],
    "buyer": {
        "name": "Foo bar",
        "personId": "123",
        "phone": "123"
    },
    "callback_url": "https://example.com/example/example/v1/example/example/example/123"
}'

I'm not sure of the drawback, but the benefit is that it would a bit cleaner, so it would be easier to read/edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions