fix: prevent GQL request failure caused by collection property computation (#5350)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Nivedin 2025-08-27 10:08:12 +05:30 committed by GitHub
parent eb8487fc82
commit ed8b85bb67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 13 deletions

View file

@ -141,21 +141,16 @@ const runQuery = async (
const inheritedHeaders =
tabs.currentActiveTab.value.document.inheritedProperties?.headers.map(
(header) => {
if (header.inheritedHeader) {
return header.inheritedHeader
}
return []
}
) as HoppGQLRequest["headers"]
(header) => header.inheritedHeader
) ?? []
await runGQLOperation({
name: request.value.name,
url: runURL,
request: request.value,
inheritedHeaders: inheritedHeaders,
inheritedHeaders,
inheritedAuth: tabs.currentActiveTab.value.document.inheritedProperties
?.auth.inheritedAuth as HoppGQLAuth,
?.auth.inheritedAuth as HoppGQLAuth | undefined,
query: runQuery,
variables: runVariables,
operationName: definition?.name?.value,

View file

@ -38,7 +38,7 @@ type ConnectionRequestOptions = {
url: string
request: HoppGQLRequest
inheritedHeaders: HoppGQLRequest["headers"]
inheritedAuth: HoppGQLAuth
inheritedAuth?: HoppGQLAuth
}
type RunQueryOptions = {
@ -46,7 +46,7 @@ type RunQueryOptions = {
url: string
request: HoppGQLRequest
inheritedHeaders: HoppGQLRequest["headers"]
inheritedAuth: HoppGQLAuth
inheritedAuth?: HoppGQLAuth
query: string
variables: string
operationName: string | undefined
@ -400,14 +400,23 @@ export const runGQLOperation = async (options: RunQueryOptions) => {
.filter((item) => item.active && item.key !== "")
.forEach(({ key, value }) => (finalHeaders[key] = value))
const finalHoppHeaders: HoppRESTHeaders = Object.entries(finalHeaders).map(
([key, value]) => ({
active: true,
key,
value,
description: "",
})
)
const gqlRequest: HoppGQLRequest = {
v: 9,
name: options.name || "Untitled Request",
url: finalUrl,
headers: runHeaders,
headers: finalHoppHeaders,
query,
variables,
auth,
auth: auth ?? request.auth,
}
if (operationType === "subscription") {