From 919eeac4a37ecf1d572769f15f425f9b18d5dfd9 Mon Sep 17 00:00:00 2001 From: Nivedin <53208152+nivedin@users.noreply.github.com> Date: Fri, 8 Aug 2025 14:18:57 +0530 Subject: [PATCH] fix: correctly resolve request variables during collection runs (#5313) Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com> --- .../hoppscotch-common/src/helpers/RequestRunner.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/hoppscotch-common/src/helpers/RequestRunner.ts b/packages/hoppscotch-common/src/helpers/RequestRunner.ts index a9a45fb3..634ef11a 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, }) ), })