From bd406616ec8404a0f3ced41a9b5d29089d69e56c Mon Sep 17 00:00:00 2001 From: Anwarul Islam Date: Fri, 23 Feb 2024 20:03:08 +0600 Subject: [PATCH] fix: collection level authorization inheritance issue (#3852) --- .../src/components/collections/index.vue | 4 +- .../src/components/graphql/Authorization.vue | 24 +++++----- .../src/components/http/Authorization.vue | 24 +++++----- .../helpers/curl/__tests__/curlparser.spec.js | 44 +++++++++---------- .../src/helpers/graphql/default.ts | 2 +- .../src/helpers/rest/default.ts | 2 +- packages/hoppscotch-data/src/graphql/index.ts | 2 +- packages/hoppscotch-data/src/rest/index.ts | 2 +- 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue index 23586436..39b4b74a 100644 --- a/packages/hoppscotch-common/src/components/collections/index.vue +++ b/packages/hoppscotch-common/src/components/collections/index.vue @@ -614,8 +614,8 @@ const addNewRootCollection = (name: string) => { requests: [], headers: [], auth: { - authType: "inherit", - authActive: false, + authType: "none", + authActive: true, }, }) ) diff --git a/packages/hoppscotch-common/src/components/graphql/Authorization.vue b/packages/hoppscotch-common/src/components/graphql/Authorization.vue index becac3c5..d1b6505d 100644 --- a/packages/hoppscotch-common/src/components/graphql/Authorization.vue +++ b/packages/hoppscotch-common/src/components/graphql/Authorization.vue @@ -31,17 +31,6 @@ tabindex="0" @keyup.escape="hide()" > - + { auth.value = { - authType: "none", + authType: "inherit", authActive: true, } } diff --git a/packages/hoppscotch-common/src/components/http/Authorization.vue b/packages/hoppscotch-common/src/components/http/Authorization.vue index 8dcff55d..f1a7b0a6 100644 --- a/packages/hoppscotch-common/src/components/http/Authorization.vue +++ b/packages/hoppscotch-common/src/components/http/Authorization.vue @@ -31,17 +31,6 @@ tabindex="0" @keyup.escape="hide()" > - + { auth.value = { - authType: "none", + authType: "inherit", authActive: true, } } diff --git a/packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js b/packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js index bf8d3841..f8f32895 100644 --- a/packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js +++ b/packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js @@ -18,7 +18,7 @@ const samples = [ method: "GET", name: "Untitled", endpoint: "https://echo.hoppscotch.io/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: "application/x-www-form-urlencoded", body: rawKeyValueEntriesToString([ @@ -149,7 +149,7 @@ const samples = [ method: "GET", name: "Untitled", endpoint: "https://google.com/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: null, body: null, @@ -166,7 +166,7 @@ const samples = [ method: "POST", name: "Untitled", endpoint: "http://localhost:1111/hello/world/?buzz", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: "application/json", body: `{\n "foo": "bar"\n}`, @@ -189,7 +189,7 @@ const samples = [ method: "GET", name: "Untitled", endpoint: "https://example.com/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: null, body: null, @@ -217,7 +217,7 @@ const samples = [ method: "POST", name: "Untitled", endpoint: "https://bing.com/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: "multipart/form-data", body: [ @@ -301,7 +301,7 @@ const samples = [ name: "Untitled", endpoint: "http://localhost:9900/", auth: { - authType: "none", + authType: "inherit", authActive: true, }, body: { @@ -345,7 +345,7 @@ const samples = [ endpoint: "https://hoppscotch.io/?io", auth: { authActive: true, - authType: "none", + authType: "inherit", }, body: { contentType: null, @@ -380,7 +380,7 @@ const samples = [ endpoint: "https://someshadywebsite.com/questionable/path/?so", auth: { authActive: true, - authType: "none", + authType: "inherit", }, body: { contentType: "multipart/form-data", @@ -441,7 +441,7 @@ const samples = [ endpoint: "http://localhost/", auth: { authActive: true, - authType: "none", + authType: "inherit", }, body: { contentType: "multipart/form-data", @@ -473,7 +473,7 @@ const samples = [ method: "GET", name: "Untitled", endpoint: "https://hoppscotch.io/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: null, body: null, @@ -528,7 +528,7 @@ const samples = [ method: "GET", name: "Untitled", endpoint: "https://echo.hoppscotch.io/", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, body: { contentType: "application/x-www-form-urlencoded", body: rawKeyValueEntriesToString([ @@ -573,7 +573,7 @@ const samples = [ name: "Untitled", endpoint: "https://echo.hoppscotch.io/", method: "POST", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [ { active: true, @@ -615,7 +615,7 @@ const samples = [ name: "Untitled", endpoint: "https://muxueqz.top/skybook.html", method: "GET", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [], body: { contentType: null, body: null }, params: [], @@ -629,7 +629,7 @@ const samples = [ name: "Untitled", endpoint: "https://echo.hoppscotch.io/", method: "POST", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [], body: { contentType: "multipart/form-data", @@ -653,7 +653,7 @@ const samples = [ name: "Untitled", endpoint: "http://127.0.0.1/", method: "CUSTOMMETHOD", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [], body: { contentType: null, @@ -670,7 +670,7 @@ const samples = [ name: "Untitled", endpoint: "https://echo.hoppscotch.io/", method: "GET", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [ { active: true, @@ -693,7 +693,7 @@ const samples = [ name: "Untitled", endpoint: "https://echo.hoppscotch.io/", method: "GET", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [], body: { contentType: null, @@ -710,7 +710,7 @@ const samples = [ name: "Untitled", endpoint: "https://example.org/", method: "HEAD", - auth: { authType: "none", authActive: true }, + auth: { authType: "inherit", authActive: true }, headers: [], body: { contentType: null, @@ -756,7 +756,7 @@ const samples = [ name: "Untitled", endpoint: "https://google.com/", auth: { - authType: "none", + authType: "inherit", authActive: true, }, body: { @@ -777,7 +777,7 @@ const samples = [ name: "Untitled", endpoint: "https://google.com/", auth: { - authType: "none", + authType: "inherit", authActive: true, }, body: { @@ -797,7 +797,7 @@ const samples = [ name: "Untitled", endpoint: "http://192.168.0.24:8080/ping", auth: { - authType: "none", + authType: "inherit", authActive: true, }, body: { @@ -817,7 +817,7 @@ const samples = [ name: "Untitled", endpoint: "https://example.com/", auth: { - authType: "none", + authType: "inherit", authActive: true, }, body: { diff --git a/packages/hoppscotch-common/src/helpers/graphql/default.ts b/packages/hoppscotch-common/src/helpers/graphql/default.ts index dd08b5f9..88d2321c 100644 --- a/packages/hoppscotch-common/src/helpers/graphql/default.ts +++ b/packages/hoppscotch-common/src/helpers/graphql/default.ts @@ -27,7 +27,7 @@ export const getDefaultGQLRequest = (): HoppGQLRequest => ({ }`, query: DEFAULT_QUERY, auth: { - authType: "none", + authType: "inherit", authActive: true, }, }) diff --git a/packages/hoppscotch-common/src/helpers/rest/default.ts b/packages/hoppscotch-common/src/helpers/rest/default.ts index 873ee2d7..d5bd45e9 100644 --- a/packages/hoppscotch-common/src/helpers/rest/default.ts +++ b/packages/hoppscotch-common/src/helpers/rest/default.ts @@ -8,7 +8,7 @@ export const getDefaultRESTRequest = (): HoppRESTRequest => ({ headers: [], method: "GET", auth: { - authType: "none", + authType: "inherit", authActive: true, }, preRequestScript: "", diff --git a/packages/hoppscotch-data/src/graphql/index.ts b/packages/hoppscotch-data/src/graphql/index.ts index 785c7d4b..ab582354 100644 --- a/packages/hoppscotch-data/src/graphql/index.ts +++ b/packages/hoppscotch-data/src/graphql/index.ts @@ -57,7 +57,7 @@ export function getDefaultGQLRequest(): HoppGQLRequest { }`.trim(), query: DEFAULT_QUERY, auth: { - authType: "none", + authType: "inherit", authActive: true, }, } diff --git a/packages/hoppscotch-data/src/rest/index.ts b/packages/hoppscotch-data/src/rest/index.ts index 575daad6..c0be3735 100644 --- a/packages/hoppscotch-data/src/rest/index.ts +++ b/packages/hoppscotch-data/src/rest/index.ts @@ -167,7 +167,7 @@ export function getDefaultRESTRequest(): HoppRESTRequest { headers: [], method: "GET", auth: { - authType: "none", + authType: "inherit", authActive: true, }, preRequestScript: "",