CurlRequestSnippet and HttpieRequestSnippet interpolate raw values into single-quoted shell strings without any escaping — request body content, header values, basic-auth credentials, cookies, form parameters, multipart part content and file names, and the URI itself.
A body containing a single quote, e.g. {"name": "O'Brien"}, produces:
$ curl 'http://localhost/foo' -i -X POST -d '{"name": "O'Brien"}'
which has an unterminated quote — pasting the documented command into a shell fails (or worse, executes something unintended). The same applies to the HTTPie snippet (echo '...' | http ...).
Reproduced on main (3ec9c63, 4.0.2-SNAPSHOT).
Expected: values interpolated into single-quoted shell strings use the standard POSIX escape (' → '\\''), so the documented commands are executable verbatim. I will submit a PR with a fix and tests.
CurlRequestSnippetandHttpieRequestSnippetinterpolate raw values into single-quoted shell strings without any escaping — request body content, header values, basic-auth credentials, cookies, form parameters, multipart part content and file names, and the URI itself.A body containing a single quote, e.g.
{"name": "O'Brien"}, produces:which has an unterminated quote — pasting the documented command into a shell fails (or worse, executes something unintended). The same applies to the HTTPie snippet (
echo '...' | http ...).Reproduced on
main(3ec9c63, 4.0.2-SNAPSHOT).Expected: values interpolated into single-quoted shell strings use the standard POSIX escape (
'→'\\''), so the documented commands are executable verbatim. I will submit a PR with a fix and tests.