[GH-ISSUE #4747] [feature]: Add the ability to manage request variables from scripting context #1773

Open
opened 2026-03-16 21:41:04 +03:00 by kerem · 2 comments
Owner

Originally created by @XWolfOverride on GitHub (Feb 12, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4747

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Using pw.env.get or pw.env.resolve in pre-request script does not fetch variables defined as request variables.

Steps to reproduce

Create new request (to https://echo.hoppscotch.io for example)

Create a request variable (not global) for example "aaa" with a value

// Set an environment variable
var option1=pw.env.resolve("<<aaa>>");
var option2=pw.env.get("aaa");

debugger;

both "option" variables are undefined

Environment

Production

Version

Cloud

Originally created by @XWolfOverride on GitHub (Feb 12, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4747 ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current behavior Using `pw.env.get` or `pw.env.resolve` in pre-request script does not fetch variables defined as *request variables.* ### Steps to reproduce Create new request (to https://echo.hoppscotch.io for example) Create a **request variable** (not global) for example "aaa" with a value ~~~ // Set an environment variable var option1=pw.env.resolve("<<aaa>>"); var option2=pw.env.get("aaa"); debugger; ~~~ both "option" variables are `undefined` ### Environment Production ### Version Cloud
Author
Owner

@ImNicolasTheDev commented on GitHub (Feb 17, 2025):

This is sadly intended. We can still only get and set global environments variables. The issue tracking the progress of the implementation of, for example, get and set request variables is here: #4590

<!-- gh-comment-id:2663126335 --> @ImNicolasTheDev commented on GitHub (Feb 17, 2025): This is ~~sadly~~ intended. We can still only *get* and *set* **global environments** variables. The issue tracking the progress of the implementation of, for example, *get* and *set* **request** variables is here: #4590
Author
Owner

@jamesgeorge007 commented on GitHub (Sep 30, 2025):

Hi, we've introduced a hopp namespace housing new scripting methods as proposed in https://github.com/hoppscotch/hoppscotch/discussions/5221 that includes support for managing request variables from the scripting context.

It's not recommended to migrate or rework your existing scripts for the new scripting APIs just yet. Breaking changes are expected as the system evolves.

The rollout is intentionally gradual to gather feedback and refine based on real-world use. All future changes will be scoped to the experimental scripting sandbox (enabled by default; can be toggled in Settings → Experiments). Please feel free to take it for a spin and let us know your feedback via the RFC above.

<!-- gh-comment-id:3350447289 --> @jamesgeorge007 commented on GitHub (Sep 30, 2025): Hi, we've introduced a `hopp` namespace housing new [scripting methods](https://docs.hoppscotch.io/documentation/features/scripts#hopp-%5Bexperimental%5D) as proposed in https://github.com/hoppscotch/hoppscotch/discussions/5221 that includes support for managing [request variables from the scripting context](https://docs.hoppscotch.io/documentation/features/scripts#request-variables). It's not recommended to migrate or rework your existing scripts for the new scripting APIs just yet. Breaking changes are expected as the system evolves. The rollout is intentionally gradual to gather feedback and refine based on real-world use. All future changes will be scoped to the experimental scripting sandbox (enabled by default; can be toggled in `Settings → Experiments`). Please feel free to take it for a spin and let us know your feedback via the RFC above.
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#1773
No description provided.