fix(copy-as): skip disabled API key auth in Copy as Curl (#811)

This commit is contained in:
Raphael Fakhri authored and GitHub committed 2026-11-10 13:44:20 -07:00
1 parent f7402f5f4f
commit 1a9b3f09a5
2 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ export async function convertToCurl(request: Partial<HttpRequest>) {
} }
// Add API key authentication // Add API key authentication
if (request.authenticationType === "apikey") { if (request.authenticationType === "apikey" && request.authentication?.disabled !== true) {
if (request.authentication?.location === "query") { if (request.authentication?.location === "query") {
const sep = finalUrl.includes("?") ? "&" : "?"; const sep = finalUrl.includes("?") ? "&" : "?";
finalUrl = [ finalUrl = [
@@ -456,6 +456,21 @@ describe("exporter-curl", () => {
).toEqual([`curl 'https://yaak.app?foo=bar&baz=qux&token='`].join(" \\\n ")); ).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 () => { test("Stale body data", async () => {
expect( expect(
await convertToCurl({ await convertToCurl({