Skip to content

Commit 9a85a73

Browse files
jaensjaenw
andauthored
Fix cURL short -d option handling (#219)
One of the code paths was not using the `arg()` helper. Co-authored-by: Jaen Saul <[email protected]>
1 parent ea95299 commit 9a85a73

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/targets/shell/curl/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const curl: Client<CurlOptions> = {
139139
const encoded = encodeURIComponent(param.name);
140140
const needsEncoding = encoded !== unencoded;
141141
const name = needsEncoding ? encoded : unencoded;
142-
const flag = binary ? '--data-binary' : `--data${needsEncoding ? '-urlencode' : ''}`;
142+
const flag = binary ? '--data-binary' : needsEncoding ? '--data-urlencode' : arg('data');
143143
push(`${flag} ${quote(`${name}=${param.value}`)}`);
144144
});
145145
} else {
Original file line numberDiff line numberDiff line change
@@ -1 +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
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' -d foo=bar

0 commit comments

Comments
 (0)