mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 09:16:03 +03:00
[PR #4275] [MERGED] feat(cli): add support for request variables #4733
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#4733
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/4275
Author: @jamesgeorge007
Created: 8/19/2024
Status: ✅ Merged
Merged: 8/26/2024
Merged by: @nivedin
Base:
next← Head:feat/cli-request-variables📝 Commits (1)
89656fcfeat: add support for request variables in the CLI📊 Changes
8 files changed (+449 additions, -45 deletions)
View changed files
📝
packages/hoppscotch-cli/package.json(+1 -1)📝
packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts(+40 -0)➕
packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/request-vars-coll.json(+188 -0)➕
packages/hoppscotch-cli/src/__tests__/e2e/fixtures/environments/request-vars-envs.json(+34 -0)📝
packages/hoppscotch-cli/src/__tests__/unit/getters.spec.ts(+107 -9)📝
packages/hoppscotch-cli/src/utils/getters.ts(+38 -9)📝
packages/hoppscotch-cli/src/utils/pre-request.ts(+40 -25)📝
packages/hoppscotch-cli/src/utils/request.ts(+1 -1)📄 Description
Description
This PR adds support for request variables in the CLI. Request variables will have the topmost priority, meaning they will be preferred over any environment variables sharing the same name.
Closes HFE-552.
Changes
getResolvedVariables()helper function added under ~/utils/getters.ts that takes in the list of request variables and environment variables for a session and returns a resolved list of variables where keys sharing the same name from environment variables are removed ensuring request variables take priority.0.11.0.Notes to reviewers
Navigate to the
hoppscotch-clipackage path locally, and runpnpm build. Run the collection via:The collection and environment export files added under test fixtures can be used to verify the behaviour comprising relevant tests covering various scenarios where a request variable comes into play:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.