diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00cb46d6f..5d281bca1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: Node.js CI on: push: - branches: [main, staging, "release/**"] + branches: [main, next, patch] pull_request: - branches: [main, staging, "release/**"] + branches: [main, next, patch] jobs: test: diff --git a/packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multiple-child-collections-auth-headers-coll.json b/packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multiple-child-collections-auth-headers-coll.json index 8e94b7df4..5cff6d510 100644 --- a/packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multiple-child-collections-auth-headers-coll.json +++ b/packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multiple-child-collections-auth-headers-coll.json @@ -1,655 +1,655 @@ { - "v": 2, - "id": "clx1f86hv000010f8szcfya0t", - "name": "Multiple child collections with authorization & headers set at each level", - "folders": [ + "v": 3, + "id": "clx1f86hv000010f8szcfya0t", + "name": "Multiple child collections with authorization & headers set at each level", + "folders": [ + { + "v": 3, + "id": "clx1fjgah000110f8a5bs68gd", + "name": "folder-1", + "folders": [ { - "v": 2, - "id": "clx1fjgah000110f8a5bs68gd", - "name": "folder-1", - "folders": [ - { - "v": 2, - "id": "clx1fjwmm000410f8l1gkkr1a", - "name": "folder-11", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "inherit", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-11-request", - "method": "GET", - "params": [], - "headers": [], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-1\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "inherit", - "authActive": true - }, - "headers": [ - { - "key": "key", - "value": "Set at folder-11", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1fjyxm000510f8pv90dt43", - "name": "folder-12", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "none", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-12-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-12-request", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-12-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-12-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-12-request\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "none", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-12", - "active": true - }, - { - "key": "key", - "value": "Set at folder-12", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1fk1cv000610f88kc3aupy", - "name": "folder-13", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "key": "api-key", - "addTo": "HEADERS", - "value": "api-key-value", - "authType": "basic", - "password": "testpass", - "username": "testuser", - "authActive": true, - "grantTypeInfo": { - "token": "", - "isPKCE": true, - "clientID": "sfasfa", - "password": "", - "username": "", - "grantType": "AUTHORIZATION_CODE", - "authEndpoint": "asfafs", - "clientSecret": "sfasfasf", - "tokenEndpoint": "asfa", - "codeVerifierMethod": "S256" - } - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-13-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header-Request-Level", - "value": "New custom header added at the folder-13-request level", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-13-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-13\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-13-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-13-request level\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "token": "test-token", - "authType": "bearer", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-13", - "active": true - }, - { - "key": "key", - "value": "Set at folder-13", - "active": true - } - ] - } - ], - "requests": [ - { - "v": "4", - "auth": { - "authType": "inherit", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-1-request", - "method": "GET", - "params": [], - "headers": [], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-1\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { + "v": 3, + "id": "clx1fjwmm000410f8l1gkkr1a", + "name": "folder-11", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { "authType": "inherit", + "password": "testpass", + "username": "testuser", "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-1", - "active": true - } - ] + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-11-request", + "method": "GET", + "params": [], + "headers": [], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-1\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "inherit", + "authActive": true + }, + "headers": [ + { + "key": "key", + "value": "Set at folder-11", + "active": true + } + ] }, { - "v": 2, - "id": "clx1fjk9o000210f8j0573pls", - "name": "folder-2", - "folders": [ - { - "v": 2, - "id": "clx1fk516000710f87sfpw6bo", - "name": "folder-21", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "inherit", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-21-request", - "method": "GET", - "params": [], - "headers": [], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-2\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "inherit", - "authActive": true - }, - "headers": [ - { - "key": "key", - "value": "Set at folder-21", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1fk72t000810f8gfwkpi5y", - "name": "folder-22", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "none", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-22-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-22-request", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-22-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-22-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-22-request\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "none", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-22", - "active": true - }, - { - "key": "key", - "value": "Set at folder-22", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1fk95g000910f8bunhaoo8", - "name": "folder-23", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "basic", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-23-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header-Request-Level", - "value": "New custom header added at the folder-23-request level", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-23-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-23\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-23-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-23-request level\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "token": "test-token", - "authType": "bearer", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-23", - "active": true - }, - { - "key": "key", - "value": "Set at folder-23", - "active": true - } - ] - } - ], - "requests": [ - { - "v": "4", - "auth": { - "authType": "none", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-2-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-2-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-2-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { + "v": 3, + "id": "clx1fjyxm000510f8pv90dt43", + "name": "folder-12", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { "authType": "none", "authActive": true - }, - "headers": [ + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-12-request", + "method": "GET", + "params": [], + "headers": [ { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-2", - "active": true + "key": "Custom-Header", + "value": "Custom header value overriden at folder-12-request", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-12-request", + "active": true } - ] + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-12-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-12-request\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "none", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-12", + "active": true + }, + { + "key": "key", + "value": "Set at folder-12", + "active": true + } + ] }, { - "v": 2, - "id": "clx1fjmlq000310f86o4d3w2o", - "name": "folder-3", - "folders": [ - { - "v": 2, - "id": "clx1iwq0p003e10f8u8zg0p85", - "name": "folder-31", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "inherit", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-31-request", - "method": "GET", - "params": [], - "headers": [], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-3\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "inherit", - "authActive": true - }, - "headers": [ - { - "key": "key", - "value": "Set at folder-31", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1izut7003m10f894ip59zg", - "name": "folder-32", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "none", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-32-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-32-request", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-32-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-32-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-32-request\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "authType": "none", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-32", - "active": true - }, - { - "key": "key", - "value": "Set at folder-32", - "active": true - } - ] - }, - { - "v": 2, - "id": "clx1j2ka9003q10f8cdbzpgpg", - "name": "folder-33", - "folders": [], - "requests": [ - { - "v": "4", - "auth": { - "authType": "basic", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-33-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header-Request-Level", - "value": "New custom header added at the folder-33-request level", - "active": true - }, - { - "key": "key", - "value": "Overriden at folder-33-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-33\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-33-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-33-request level\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "token": "test-token", - "authType": "bearer", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-33", - "active": true - }, - { - "key": "key", - "value": "Set at folder-33", - "active": true - } - ] - } - ], - "requests": [ - { - "v": "4", - "auth": { - "authType": "basic", - "password": "testpass", - "username": "testuser", - "authActive": true - }, - "body": { - "body": null, - "contentType": null - }, - "name": "folder-3-request", - "method": "GET", - "params": [], - "headers": [ - { - "key": "Custom-Header-Request-Level", - "value": "New custom header added at the folder-3-request level", - "active": true - }, - { - "key": "key", - "value": "Set at folder-3-request", - "active": true - } - ], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-3\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Set at folder-3-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-3-request level\")\n})", - "preRequestScript": "", - "requestVariables": [] - } - ], - "auth": { - "key": "testuser", + "v": 3, + "id": "clx1fk1cv000610f88kc3aupy", + "name": "folder-13", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "key": "api-key", "addTo": "HEADERS", - "value": "testpass", + "value": "api-key-value", + "authType": "basic", + "password": "testpass", + "username": "testuser", + "authActive": true, + "grantTypeInfo": { + "token": "", + "isPKCE": true, + "clientID": "sfasfa", + "password": "", + "username": "", + "grantType": "AUTHORIZATION_CODE", + "authEndpoint": "asfafs", + "clientSecret": "sfasfasf", + "tokenEndpoint": "asfa", + "codeVerifierMethod": "S256" + } + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-13-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header-Request-Level", + "value": "New custom header added at the folder-13-request level", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-13-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-13\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-13-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-13-request level\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "token": "test-token", + "authType": "bearer", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-13", + "active": true + }, + { + "key": "key", + "value": "Set at folder-13", + "active": true + } + ] + } + ], + "requests": [ + { + "v": "4", + "auth": { + "authType": "inherit", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-1-request", + "method": "GET", + "params": [], + "headers": [], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-1\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "inherit", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-1", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1fjk9o000210f8j0573pls", + "name": "folder-2", + "folders": [ + { + "v": 3, + "id": "clx1fk516000710f87sfpw6bo", + "name": "folder-21", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "authType": "inherit", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-21-request", + "method": "GET", + "params": [], + "headers": [], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-2\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "inherit", + "authActive": true + }, + "headers": [ + { + "key": "key", + "value": "Set at folder-21", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1fk72t000810f8gfwkpi5y", + "name": "folder-22", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "authType": "none", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-22-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-22-request", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-22-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-22-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-22-request\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "none", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-22", + "active": true + }, + { + "key": "key", + "value": "Set at folder-22", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1fk95g000910f8bunhaoo8", + "name": "folder-23", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { "authType": "basic", "password": "testpass", "username": "testuser", "authActive": true - }, - "headers": [ - { - "key": "Custom-Header", - "value": "Custom header value overriden at folder-3", - "active": true - } - ] - } - ], - "requests": [ - { - "v": "4", - "auth": { - "authType": "inherit", - "authActive": true - }, - "body": { + }, + "body": { "body": null, "contentType": null + }, + "name": "folder-23-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header-Request-Level", + "value": "New custom header added at the folder-23-request level", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-23-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-23\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-23-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-23-request level\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "token": "test-token", + "authType": "bearer", + "password": "testpass", + "username": "testuser", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-23", + "active": true }, - "name": "root-collection-request", - "method": "GET", - "params": [], - "headers": [], - "endpoint": "https://httpbin.org/get", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value set at the root collection\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", - "preRequestScript": "", - "requestVariables": [] + { + "key": "key", + "value": "Set at folder-23", + "active": true + } + ] } - ], - "auth": { + ], + "requests": [ + { + "v": "4", + "auth": { + "authType": "none", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-2-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-2-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-2-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "none", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-2", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1fjmlq000310f86o4d3w2o", + "name": "folder-3", + "folders": [ + { + "v": 3, + "id": "clx1iwq0p003e10f8u8zg0p85", + "name": "folder-31", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "authType": "inherit", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-31-request", + "method": "GET", + "params": [], + "headers": [], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-3\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "inherit", + "authActive": true + }, + "headers": [ + { + "key": "key", + "value": "Set at folder-31", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1izut7003m10f894ip59zg", + "name": "folder-32", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "authType": "none", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-32-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-32-request", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-32-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(undefined)\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-32-request\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-32-request\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "none", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-32", + "active": true + }, + { + "key": "key", + "value": "Set at folder-32", + "active": true + } + ] + }, + { + "v": 3, + "id": "clx1j2ka9003q10f8cdbzpgpg", + "name": "folder-33", + "folders": [], + "requests": [ + { + "v": "4", + "auth": { + "authType": "basic", + "password": "testpass", + "username": "testuser", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-33-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header-Request-Level", + "value": "New custom header added at the folder-33-request level", + "active": true + }, + { + "key": "key", + "value": "Overriden at folder-33-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-33\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Overriden at folder-33-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-33-request level\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "token": "test-token", + "authType": "bearer", + "password": "testpass", + "username": "testuser", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value overriden at folder-33", + "active": true + }, + { + "key": "key", + "value": "Set at folder-33", + "active": true + } + ] + } + ], + "requests": [ + { + "v": "4", + "auth": { + "authType": "basic", + "password": "testpass", + "username": "testuser", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "folder-3-request", + "method": "GET", + "params": [], + "headers": [ + { + "key": "Custom-Header-Request-Level", + "value": "New custom header added at the folder-3-request level", + "active": true + }, + { + "key": "key", + "value": "Set at folder-3-request", + "active": true + } + ], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits/overrides authorization/header set at the parent collection level with new header addition\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value overriden at folder-3\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n pw.expect(pw.response.body.headers[\"Key\"]).toBe(\"Set at folder-3-request\")\n pw.expect(pw.response.body.headers[\"Custom-Header-Request-Level\"]).toBe(\"New custom header added at the folder-3-request level\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "key": "testuser", + "addTo": "HEADERS", + "value": "testpass", "authType": "basic", "password": "testpass", "username": "testuser", "authActive": true - }, - "headers": [ + }, + "headers": [ { - "key": "Custom-Header", - "value": "Custom header value set at the root collection", - "active": true - }, - { - "key": "Inherited-Header", - "value": "Inherited header at all levels", - "active": true + "key": "Custom-Header", + "value": "Custom header value overriden at folder-3", + "active": true } - ] -} \ No newline at end of file + ] + } + ], + "requests": [ + { + "v": "4", + "auth": { + "authType": "inherit", + "authActive": true + }, + "body": { + "body": null, + "contentType": null + }, + "name": "root-collection-request", + "method": "GET", + "params": [], + "headers": [], + "endpoint": "https://httpbin.org/get", + "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\npw.test(\"Successfully inherits authorization/header set at the parent collection level\", () => {\n pw.expect(pw.response.body.headers[\"Authorization\"]).toBe(\"Basic dGVzdHVzZXI6dGVzdHBhc3M=\")\n \n pw.expect(pw.response.body.headers[\"Custom-Header\"]).toBe(\"Custom header value set at the root collection\")\n pw.expect(pw.response.body.headers[\"Inherited-Header\"]).toBe(\"Inherited header at all levels\")\n})", + "preRequestScript": "", + "requestVariables": [] + } + ], + "auth": { + "authType": "basic", + "password": "testpass", + "username": "testuser", + "authActive": true + }, + "headers": [ + { + "key": "Custom-Header", + "value": "Custom header value set at the root collection", + "active": true + }, + { + "key": "Inherited-Header", + "value": "Inherited header at all levels", + "active": true + } + ] +} diff --git a/packages/hoppscotch-cli/src/__tests__/unit/fixtures/workspace-access.mock.ts b/packages/hoppscotch-cli/src/__tests__/unit/fixtures/workspace-access.mock.ts index 272ca22b0..daee18f64 100644 --- a/packages/hoppscotch-cli/src/__tests__/unit/fixtures/workspace-access.mock.ts +++ b/packages/hoppscotch-cli/src/__tests__/unit/fixtures/workspace-access.mock.ts @@ -15,7 +15,7 @@ export const WORKSPACE_DEEPLY_NESTED_COLLECTIONS_WITH_AUTH_HEADERS_MOCK: Workspa [ { id: "clx1ldkzs005t10f8rp5u60q7", - data: '{"auth":{"token":"BearerToken","authType":"bearer","authActive":true},"headers":[{"key":"X-Test-Header","value":"Set at root collection","active":true}]}', + data: '{"auth":{"token":"BearerToken","authType":"bearer","authActive":true},"headers":[{"key":"X-Test-Header","value":"Set at root collection","active":true,"description":""}]}', title: "CollectionA", parentID: null, folders: [ @@ -245,6 +245,7 @@ export const TRANSFORMED_DEEPLY_NESTED_COLLECTIONS_WITH_AUTH_HEADERS_MOCK: HoppC key: "X-Test-Header", value: "Set at root collection", active: true, + description: "", }, ], }, @@ -547,12 +548,12 @@ export const WORKSPACE_COLLECTIONS_WITHOUT_AUTH_HEADERS_AT_CERTAIN_LEVELS_MOCK: export const TRANSFORMED_COLLECTIONS_WITHOUT_AUTH_HEADERS_AT_CERTAIN_LEVELS_MOCK: HoppCollection[] = [ { - v: 2, + v: CollectionSchemaVersion, id: "clx1kxvao005m10f8luqivrf1", name: "Collection with no authorization/headers set", folders: [ { - v: 2, + v: CollectionSchemaVersion, id: "clx1kygjt005n10f8m1nkhjux", name: "folder-1", folders: [], @@ -584,7 +585,7 @@ export const TRANSFORMED_COLLECTIONS_WITHOUT_AUTH_HEADERS_AT_CERTAIN_LEVELS_MOCK headers: [], }, { - v: 2, + v: CollectionSchemaVersion, id: "clx1kym98005o10f8qg17t9o2", name: "folder-2", folders: [], @@ -622,7 +623,7 @@ export const TRANSFORMED_COLLECTIONS_WITHOUT_AUTH_HEADERS_AT_CERTAIN_LEVELS_MOCK ], }, { - v: 2, + v: CollectionSchemaVersion, id: "clx1l2bu6005r10f8daynohge", name: "folder-3", folders: [], @@ -634,7 +635,7 @@ export const TRANSFORMED_COLLECTIONS_WITHOUT_AUTH_HEADERS_AT_CERTAIN_LEVELS_MOCK headers: [], }, { - v: 2, + v: CollectionSchemaVersion, id: "clx1l2eaz005s10f8loetbbeb", name: "folder-4", folders: [], diff --git a/packages/hoppscotch-cli/src/__tests__/unit/getters.spec.ts b/packages/hoppscotch-cli/src/__tests__/unit/getters.spec.ts index ae3dff89b..3950a9fe6 100644 --- a/packages/hoppscotch-cli/src/__tests__/unit/getters.spec.ts +++ b/packages/hoppscotch-cli/src/__tests__/unit/getters.spec.ts @@ -61,6 +61,7 @@ describe("getters", () => { active: true, key: "<>", value: "<>", + description: "", }, ], environmentVariables @@ -71,7 +72,7 @@ describe("getters", () => { test("Inactive list of meta-data", () => { expect( getEffectiveFinalMetaData( - [{ active: false, key: "KEY", value: "<>" }], + [{ active: false, key: "KEY", value: "<>", description: "" }], environmentVariables ) ).toSubsetEqualRight([]); @@ -80,7 +81,7 @@ describe("getters", () => { test("Active list of meta-data", () => { expect( getEffectiveFinalMetaData( - [{ active: true, key: "PARAM", value: "<>" }], + [{ active: true, key: "PARAM", value: "<>", description: "" }], environmentVariables ) ).toSubsetEqualRight([ diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index e4bd4437c..d079e7caf 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -242,6 +242,8 @@ "header": "Header {count}", "message": "Message {count}", "parameter": "Parameter {count}", + "key": "Key {count}", + "description": "Description {count}", "protocol": "Protocol {count}", "value": "Value {count}", "variable": "Variable {count}" diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts index 8ff1054de..b82d0a3f9 100644 --- a/packages/hoppscotch-common/src/components.d.ts +++ b/packages/hoppscotch-common/src/components.d.ts @@ -136,6 +136,7 @@ declare module 'vue' { HttpCodegenModal: typeof import('./components/http/CodegenModal.vue')['default'] HttpHeaders: typeof import('./components/http/Headers.vue')['default'] HttpImportCurl: typeof import('./components/http/ImportCurl.vue')['default'] + HttpKeyValue: typeof import('./components/http/KeyValue.vue')['default'] HttpOAuth2Authorization: typeof import('./components/http/OAuth2Authorization.vue')['default'] HttpParameters: typeof import('./components/http/Parameters.vue')['default'] HttpPreRequestScript: typeof import('./components/http/PreRequestScript.vue')['default'] diff --git a/packages/hoppscotch-common/src/components/collections/Properties.vue b/packages/hoppscotch-common/src/components/collections/Properties.vue index e44f9f492..d9c80f16d 100644 --- a/packages/hoppscotch-common/src/components/collections/Properties.vue +++ b/packages/hoppscotch-common/src/components/collections/Properties.vue @@ -4,6 +4,7 @@ dialog :title="t('collection.properties')" :full-width-body="true" + styles="sm:max-w-2xl" @close="hideModal" >