fix authorization hierarchy in postman import (#4686)
Co-authored-by: nivedin <nivedinp@gmail.com>
This commit is contained in:
parent
e22fbecb56
commit
fa1159da53
1 changed files with 10 additions and 5 deletions
|
|
@ -197,12 +197,17 @@ type PMRequestAuthDef<
|
|||
const getVariableValue = (defs: VariableDefinition[], key: string) =>
|
||||
defs.find((param) => param.key === key)?.value as string | undefined
|
||||
|
||||
const getHoppReqAuth = (hoppAuth: Item["request"]["auth"]): HoppRESTAuth => {
|
||||
if (!hoppAuth) return { authType: "none", authActive: true }
|
||||
const getHoppReqAuth = (
|
||||
hoppAuth: Item["request"]["auth"] | null
|
||||
): HoppRESTAuth => {
|
||||
if (!hoppAuth) return { authType: "inherit", authActive: false }
|
||||
|
||||
// Cast to the type for more stricter checking down the line
|
||||
const auth = hoppAuth as unknown as PMRequestAuthDef
|
||||
|
||||
if (auth.type === "noauth") {
|
||||
return { authType: "none", authActive: true }
|
||||
}
|
||||
|
||||
if (auth.type === "basic") {
|
||||
return {
|
||||
authType: "basic",
|
||||
|
|
@ -269,7 +274,7 @@ const getHoppReqAuth = (hoppAuth: Item["request"]["auth"]): HoppRESTAuth => {
|
|||
}
|
||||
}
|
||||
|
||||
return { authType: "none", authActive: true }
|
||||
return { authType: "inherit", authActive: true }
|
||||
}
|
||||
|
||||
const getHoppReqBody = ({
|
||||
|
|
@ -413,7 +418,7 @@ const getHoppFolder = (ig: ItemGroup<Item>): HoppCollection =>
|
|||
A.map(getHoppFolder)
|
||||
),
|
||||
requests: pipe(ig.items.all(), A.filter(isPMItem), A.map(getHoppRequest)),
|
||||
auth: { authType: "inherit", authActive: true },
|
||||
auth: getHoppReqAuth(ig.auth),
|
||||
headers: [],
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue