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: correctly resolve request variables during collection runs (#5313)

Nivedin919eeac4a37e
diff --git a/packages/hoppscotch-common/src/helpers/RequestRunner.ts b/packages/hoppscotch-common/src/helpers/RequestRunner.ts
index a9a45fb3d..634ef11a0 100644
--- a/packages/hoppscotch-common/src/helpers/RequestRunner.ts
+++ b/packages/hoppscotch-common/src/helpers/RequestRunner.ts
@@ -587,6 +587,17 @@ export function runTestRunnerRequest(
return E.left("script_fail" as const)
}
+ const finalRequestVariables = pipe(
+ request.requestVariables,
+ A.filter(({ active }) => active),
+ A.map(({ key, value }) => ({
+ key,
+ initialValue: value,
+ currentValue: value,
+ secret: false,
+ }))
+ )
+
const effectiveRequest = await getEffectiveRESTRequest(request, {
id: "env-id",
v: 2,
@@ -597,7 +608,7 @@ export function runTestRunnerRequest(
...preRequestScriptResult.right.envs,
temp: !persistEnv ? getTemporaryVariables() : [],
},
- requestVariables: [],
+ requestVariables: finalRequestVariables,
})
),
})