Convert Postman's simple dynamic variables to template functions (#680)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-15 13:48:27 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent c9990d8492
commit ae518dfb4c
6 changed files with 230 additions and 22 deletions
@@ -154,6 +154,35 @@ describe("importer-postman", () => {
]);
});
test("Leaves {{constructor}} alone instead of reaching Object.prototype", () => {
const result = convertPostman(
JSON.stringify({
info: {
name: "Prototype Key",
schema: "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
},
item: [
{
name: "Request",
request: {
method: "GET",
url: "https://yaak.app",
header: [
{ key: "X-A", value: "{{constructor}}" },
{ key: "X-B", value: "{{toString}}" },
],
},
},
],
}),
);
expect(result?.resources.httpRequests[0]?.headers).toEqual([
{ name: "X-A", value: "${[constructor]}", enabled: true },
{ name: "X-B", value: "${[toString]}", enabled: true },
]);
});
test("Omits keys for items the collection never identified", () => {
const result = convertPostman(
JSON.stringify({