diff --git a/src/targets/shell/curl/client.ts b/src/targets/shell/curl/client.ts index 015427550..d0ba163f0 100644 --- a/src/targets/shell/curl/client.ts +++ b/src/targets/shell/curl/client.ts @@ -139,7 +139,7 @@ export const curl: Client = { const encoded = encodeURIComponent(param.name); const needsEncoding = encoded !== unencoded; const name = needsEncoding ? encoded : unencoded; - const flag = binary ? '--data-binary' : `--data${needsEncoding ? '-urlencode' : ''}`; + const flag = binary ? '--data-binary' : needsEncoding ? '--data-urlencode' : arg('data'); push(`${flag} ${quote(`${name}=${param.value}`)}`); }); } else { diff --git a/src/targets/shell/curl/fixtures/short-options.sh b/src/targets/shell/curl/fixtures/short-options.sh index f2670d7b8..6f123f22f 100755 --- a/src/targets/shell/curl/fixtures/short-options.sh +++ b/src/targets/shell/curl/fixtures/short-options.sh @@ -1 +1 @@ -curl -X POST 'https://httpbin.org/anything?foo=bar&foo=baz&baz=abc&key=value' -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' -b 'foo=bar; bar=baz' --data foo=bar \ No newline at end of file +curl -X POST 'https://httpbin.org/anything?foo=bar&foo=baz&baz=abc&key=value' -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' -b 'foo=bar; bar=baz' -d foo=bar \ No newline at end of file