From 1a9b3f09a51be39093501466cbfba246c8279c77 Mon Sep 17 00:00:00 2001 From: Raphael Fakhri Date: Tue, 10 Nov 2026 22:44:20 +0200 Subject: [PATCH] fix(copy-as): skip disabled API key auth in Copy as Curl (#811) --- plugins/action-copy-curl/src/index.ts | 2 +- plugins/action-copy-curl/tests/index.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/action-copy-curl/src/index.ts b/plugins/action-copy-curl/src/index.ts index 1efbaf3c5..519db3160 100644 --- a/plugins/action-copy-curl/src/index.ts +++ b/plugins/action-copy-curl/src/index.ts @@ -44,7 +44,7 @@ export async function convertToCurl(request: Partial) { } // Add API key authentication - if (request.authenticationType === "apikey") { + if (request.authenticationType === "apikey" && request.authentication?.disabled !== true) { if (request.authentication?.location === "query") { const sep = finalUrl.includes("?") ? "&" : "?"; finalUrl = [ diff --git a/plugins/action-copy-curl/tests/index.test.ts b/plugins/action-copy-curl/tests/index.test.ts index 3f2e167a4..44846d576 100644 --- a/plugins/action-copy-curl/tests/index.test.ts +++ b/plugins/action-copy-curl/tests/index.test.ts @@ -456,6 +456,21 @@ describe("exporter-curl", () => { ).toEqual([`curl 'https://yaak.app?foo=bar&baz=qux&token='`].join(" \\\n ")); }); + test("API key auth disabled", async () => { + expect( + await convertToCurl({ + url: "https://yaak.app", + authenticationType: "apikey", + authentication: { + disabled: true, + location: "header", + key: "X-Header", + value: "my-token", + }, + }), + ).toEqual([`curl 'https://yaak.app'`].join(" \\\n ")); + }); + test("Stale body data", async () => { expect( await convertToCurl({