Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: support -d argument in curl parser (#3236)

Bogdan Chadkin7de578690984
diff --git a/apps/builder/app/builder/features/settings-panel/curl.test.ts b/apps/builder/app/builder/features/settings-panel/curl.test.ts
index 92e877c8c9..191f18b7ef 100644
--- a/apps/builder/app/builder/features/settings-panel/curl.test.ts
+++ b/apps/builder/app/builder/features/settings-panel/curl.test.ts
@@ -88,6 +88,14 @@ test("support text body", () => {
headers: [],
body: `{"param":"value"}`,
});
+ expect(
+ parseCurl(`curl https://my-url/hello-world -d '{"param":"value"}'`)
+ ).toEqual({
+ url: "https://my-url/hello-world",
+ method: "post",
+ headers: [],
+ body: `{"param":"value"}`,
+ });
});
test("support text body with explicit method", () => {
diff --git a/apps/builder/app/builder/features/settings-panel/curl.ts b/apps/builder/app/builder/features/settings-panel/curl.ts
index 890e668232..e5b8cc28d7 100644
--- a/apps/builder/app/builder/features/settings-panel/curl.ts
+++ b/apps/builder/app/builder/features/settings-panel/curl.ts
@@ -35,6 +35,7 @@ export const parseCurl = (curl: string): undefined | CurlRequest => {
alias: {
X: ["request"],
H: ["header"],
+ d: ["data"],
},
string: ["request", "data"],
array: ["header", "H"],