[PR #5158] fix: update environment variables immediately after pre-request scrip… #5084

Open
opened 2026-03-17 02:33:49 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5158
Author: @evanqhuang
Created: 6/17/2025
Status: 🔄 Open

Base: mainHead: fix/env-vars-race-condition


📝 Commits (1)

  • 6ac29ff fix: update environment variables immediately after pre-request script execution

📊 Changes

1 file changed (+23 additions, -5 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/RequestRunner.ts (+23 -5)

📄 Description

…t execution

This change addresses a race condition where environment variables set in pre-request scripts weren't immediately available to concurrent requests.

https://github.com/hoppscotch/hoppscotch/issues/4788

Changes:

  • Added updateEnvironmentsFromScript helper to eliminate code duplication
  • Update environments immediately after pre-request script execution in both runRESTRequest$ and runTestRunnerRequest
  • Ensures environment changes are persisted before request execution continues

Closes #

What's changed

Notes to reviewers


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5158 **Author:** [@evanqhuang](https://github.com/evanqhuang) **Created:** 6/17/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/env-vars-race-condition` --- ### 📝 Commits (1) - [`6ac29ff`](https://github.com/hoppscotch/hoppscotch/commit/6ac29ff547acfd7e244966ca947c5846398a6529) fix: update environment variables immediately after pre-request script execution ### 📊 Changes **1 file changed** (+23 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/RequestRunner.ts` (+23 -5) </details> ### 📄 Description …t execution This change addresses a race condition where environment variables set in pre-request scripts weren't immediately available to concurrent requests. https://github.com/hoppscotch/hoppscotch/issues/4788 Changes: - Added updateEnvironmentsFromScript helper to eliminate code duplication - Update environments immediately after pre-request script execution in both runRESTRequest$ and runTestRunnerRequest - Ensures environment changes are persisted before request execution continues <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes # <!-- Issue # here --> <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> ### What's changed <!-- Describe point by point the different things you have changed in this PR --> <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Notes to reviewers <!-- Any information you feel the reviewer should know about when reviewing your PR --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5084
No description provided.