mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-27 13:54:11 +02:00
fix(copy-as): emit shell-safe arguments in the curl and gRPCurl exporters (#593)
This commit is contained in:
@@ -175,4 +175,21 @@ describe("exporter-curl", () => {
|
||||
].join(" \\\n "),
|
||||
);
|
||||
});
|
||||
|
||||
test("Quotes an apostrophe so the command still parses", async () => {
|
||||
// POSIX single quotes take no escapes: `\'` ends the string one
|
||||
// character early and leaves the rest of the command dangling.
|
||||
const command = await convert(
|
||||
{
|
||||
url: "https://yaak.app",
|
||||
service: "Service",
|
||||
method: "Method",
|
||||
message: `{"note":"don't stop"}`,
|
||||
metadata: [{ name: "x-note", value: "it's fine" }],
|
||||
},
|
||||
[],
|
||||
);
|
||||
expect(command).toContain(`'{"note":"don'\\''t stop"}'`);
|
||||
expect(command).toContain(`'x-note: it'\\''s fine'`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user