[GH-ISSUE #2105] [feature]: Set default env variable value #704

Closed
opened 2026-03-16 16:48:39 +03:00 by kerem · 1 comment
Owner

Originally created by @leomp12 on GitHub (Feb 2, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2105

Is there an existing issue for this?

  • I have searched the existing issues

Summary

Support setting fallback value to env variables with something like <<baseUri | "https://api.io/v1/">>.

Alternative implementation

It would also be feasible (not so friendly) if we can call pw.env.get (as Postman does) on Pre-Request Scripts:

const baseUri = pw.env.get("baseUri");
if (!baseUri) {
  pw.env.set("baseUri", "https://api.io/v1/");
}

Why should this be worked on?

It would be helpful to share (Copy link) to end users the same request that you are using in development, working on just one click without the need to set up environment.

I'm currently thinking of duplicating requests to do this, not so good ...

Originally created by @leomp12 on GitHub (Feb 2, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2105 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Summary Support setting fallback value to env variables with something like `<<baseUri | "https://api.io/v1/">>`. **Alternative implementation** It would also be feasible (not so friendly) if we can call `pw.env.get` (as Postman does) on Pre-Request Scripts: ```js const baseUri = pw.env.get("baseUri"); if (!baseUri) { pw.env.set("baseUri", "https://api.io/v1/"); } ``` ### Why should this be worked on? It would be helpful to share (_Copy link_) to end users the same request that you are using in development, working on just one click without the need to set up environment. > I'm currently thinking of duplicating requests to do this, not so good ...
kerem 2026-03-16 16:48:39 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@leomp12 commented on GitHub (Mar 3, 2022):

Not sure (not checked yet) if I was wrong when open the issue or the pw.env.get was really made available on Pre-Request Scripts as suggested as alternative implementation.
Anyway, it's working now so I'm closing the issue 😃
Thanks!

<!-- gh-comment-id:1057525999 --> @leomp12 commented on GitHub (Mar 3, 2022): Not sure (not checked yet) if I was wrong when open the issue or the `pw.env.get` was really made available on Pre-Request Scripts as suggested as _alternative implementation_. Anyway, it's working now so I'm closing the issue 😃 Thanks!
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#704
No description provided.