fix: use proper values for addTo field when auth type is api-key (#3966)
This commit is contained in:
@@ -281,9 +281,9 @@ export const runGQLOperation = async (options: RunQueryOptions) => {
|
||||
}
|
||||
} else if (auth.authType === "api-key") {
|
||||
const { key, value, addTo } = auth
|
||||
if (addTo === "Headers") {
|
||||
if (addTo === "HEADERS") {
|
||||
finalHeaders[key] = value
|
||||
} else if (addTo === "Query params") {
|
||||
} else if (addTo === "QUERY_PARAMS") {
|
||||
params[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ const resolveOpenAPIV3SecurityObj = (
|
||||
return {
|
||||
authType: "api-key",
|
||||
authActive: true,
|
||||
addTo: "Headers",
|
||||
addTo: "HEADERS",
|
||||
key: scheme.name,
|
||||
value: "",
|
||||
}
|
||||
@@ -268,7 +268,7 @@ const resolveOpenAPIV3SecurityObj = (
|
||||
return {
|
||||
authType: "api-key",
|
||||
authActive: true,
|
||||
addTo: "Query params",
|
||||
addTo: "QUERY_PARAMS",
|
||||
key: scheme.in,
|
||||
value: "",
|
||||
}
|
||||
@@ -430,7 +430,7 @@ const resolveOpenAPIV2SecurityScheme = (
|
||||
// V2 only supports in: header and in: query
|
||||
return {
|
||||
authType: "api-key",
|
||||
addTo: scheme.in === "header" ? "Headers" : "Query params",
|
||||
addTo: scheme.in === "header" ? "HEADERS" : "QUERY_PARAMS",
|
||||
authActive: true,
|
||||
key: scheme.name,
|
||||
value: "",
|
||||
|
||||
@@ -150,8 +150,8 @@ const getHoppReqAuth = (item: Item): HoppRESTAuth => {
|
||||
),
|
||||
addTo:
|
||||
(getVariableValue(auth.apikey, "in") ?? "query") === "query"
|
||||
? "Query params"
|
||||
: "Headers",
|
||||
? "QUERY_PARAMS"
|
||||
: "HEADERS",
|
||||
}
|
||||
} else if (auth.type === "bearer") {
|
||||
return {
|
||||
|
||||
@@ -96,7 +96,7 @@ export const getComputedAuthHeaders = (
|
||||
})
|
||||
} else if (request.auth.authType === "api-key") {
|
||||
const { key, addTo } = request.auth
|
||||
if (addTo === "Headers" && key) {
|
||||
if (addTo === "HEADERS" && key) {
|
||||
headers.push({
|
||||
active: true,
|
||||
key: parseTemplateString(key, envVars),
|
||||
|
||||
Reference in New Issue
Block a user