Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hidden-window): enable baseEnvironment in the pre-request scripting [INS-3379] #7102

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Feb 22, 2024

Changes:

  • : enable base environment in pre-request scripting
  • : make base environment modification work in rendering
  • : add tests for cover it

filfreire
filfreire previously approved these changes Feb 22, 2024
Copy link
Member

@filfreire filfreire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only has one problem where maybe base environment should not override what we send on the pre-request

insomnia.baseEnvironment.set("testfilipe", "filipe")
pm.collectionVariables.set("testfilipe", "george")

Copy link
Contributor

@gatzjames gatzjames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also test environment overrides on the folder level.
If you put a request inside a folder, the folder has an option to add environment overrides that override environment variables

@ihexxa
Copy link
Contributor Author

ihexxa commented Feb 23, 2024

Thank you for comments! The overriding issue is fixed.
Regarding folder environments, this is a really good point. The workflow might be a bit not intuitive: currently scripts mainly manipulates environment from "collection" level, although script is at request level. Then script's environment modifications will be overridden by folder environments. When the per-request variables are introduced, it can also be manipulated by script, which will override folder environments.

@ihexxa ihexxa merged commit d7a0bc1 into develop Feb 23, 2024
7 checks passed
@ihexxa ihexxa deleted the pre-script-base-env branch February 23, 2024 12:00
@ihexxa ihexxa changed the title feat(hidden-window): enable baseEnvironment in the pre-request scripting feat(hidden-window): enable baseEnvironment in the pre-request scripting [INS-3379] Feb 26, 2024
jackkav pushed a commit to jackkav/insomnia that referenced this pull request Mar 13, 2024
…ing (Kong#7102)

* feat(hidden-window): enable baseEnvironment in the pre-request scripting

* fix: input empty selected environment data to avoid incorrect environment manipulation and overriding

* test: add a test for folder environments overriding

* fix: smoke tests failed because of env overriding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants