mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
fix(copy-as): skip disabled API key auth in Copy as Curl (#811)
This commit is contained in:
1 parent
f7402f5f4f
commit
1a9b3f09a5
2 files changed
+16
-1
No files matched your search
@@ -44,7 +44,7 @@ export async function convertToCurl(request: Partial<HttpRequest>) {
|
||||
}
|
||||
|
||||
// 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 = [
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user