mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-16 14:51:37 +02:00
Convert Postman's simple dynamic variables to template functions (#680)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c9990d8492
commit
ae518dfb4c
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user