Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: collection level authorization inheritance issue (#3852)

Anwarul Islambd406616ec84
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 235864360..39b4b74ad 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 becac3c56..d1b6505de 100644
--- a/packages/hoppscotch-common/src/components/graphql/Authorization.vue
+++ b/packages/hoppscotch-common/src/components/graphql/Authorization.vue
@@ -32,24 +32,24 @@
@keyup.escape="hide()"
>
<HoppSmartItem
- label="None"
- :icon="authName === 'None' ? IconCircleDot : IconCircle"
- :active="authName === 'None'"
+ v-if="!isRootCollection"
+ label="Inherit"
+ :icon="authName === 'Inherit' ? IconCircleDot : IconCircle"
+ :active="authName === 'Inherit'"
@click="
() => {
- auth.authType = 'none'
+ auth.authType = 'inherit'
hide()
}
"
/>
<HoppSmartItem
- v-if="!isRootCollection"
- label="Inherit"
- :icon="authName === 'Inherit' ? IconCircleDot : IconCircle"
- :active="authName === 'Inherit'"
+ label="None"
+ :icon="authName === 'None' ? IconCircleDot : IconCircle"
+ :active="authName === 'None'"
@click="
() => {
- auth.authType = 'inherit'
+ auth.authType = 'none'
hide()
}
"
@@ -284,7 +284,7 @@ const authActive = pluckRef(auth, "authActive")
const clearContent = () => {
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 8dcff55da..f1a7b0a60 100644
--- a/packages/hoppscotch-common/src/components/http/Authorization.vue
+++ b/packages/hoppscotch-common/src/components/http/Authorization.vue
@@ -32,24 +32,24 @@
@keyup.escape="hide()"
>
<HoppSmartItem
- label="None"
- :icon="authName === 'None' ? IconCircleDot : IconCircle"
- :active="authName === 'None'"
+ v-if="!isRootCollection"
+ label="Inherit"
+ :icon="authName === 'Inherit' ? IconCircleDot : IconCircle"
+ :active="authName === 'Inherit'"
@click="
() => {
- auth.authType = 'none'
+ auth.authType = 'inherit'
hide()
}
"
/>
<HoppSmartItem
- v-if="!isRootCollection"
- label="Inherit"
- :icon="authName === 'Inherit' ? IconCircleDot : IconCircle"
- :active="authName === 'Inherit'"
+ label="None"
+ :icon="authName === 'None' ? IconCircleDot : IconCircle"
+ :active="authName === 'None'"
@click="
() => {
- auth.authType = 'inherit'
+ auth.authType = 'none'
hide()
}
"
@@ -265,7 +265,7 @@ const authActive = pluckRef(auth, "authActive")
const clearContent = () => {
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 bf8d38412..f8f32895d 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 dd08b5f92..88d2321c5 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 873ee2d7d..d5bd45e9f 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 785c7d4b4..ab5823541 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 575daad64..c0be37354 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: "",