mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #3886] [MERGED] feat: support for predefined variables #4569
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#4569
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/3886
Author: @kishannareshpal
Created: 3/10/2024
Status: ✅ Merged
Merged: 9/30/2024
Merged by: @jamesgeorge007
Base:
next← Head:feat/predefined-variable📝 Commits (10+)
2da7128feat: support for predefined variables (WIP)fca9787fix: working prototype15943d6chore: predefined varilable colore284c76feat: added more predefined variablesd85011ffix: ensure pre-defined variables resolve correctly during request execution170b00efeat: account for pre-defined variables in the autocomplete list8aa9cc5feat: highlight pre-defined variables under request variables in bulk modee72aec1chore: refrain from highlighting pre-defined variables in the realtime page1749935chore: cleanupa59306achore: clean up📊 Changes
14 files changed (+608 additions, -17 deletions)
View changed files
📝
packages/hoppscotch-common/assets/scss/styles.scss(+14 -0)📝
packages/hoppscotch-common/src/components/environments/my/Details.vue(+2 -2)📝
packages/hoppscotch-common/src/components/http/Headers.vue(+1 -0)📝
packages/hoppscotch-common/src/components/http/Parameters.vue(+1 -0)📝
packages/hoppscotch-common/src/components/http/RawBody.vue(+1 -0)📝
packages/hoppscotch-common/src/components/http/RequestVariables.vue(+1 -0)📝
packages/hoppscotch-common/src/components/http/URLEncodedParams.vue(+1 -0)📝
packages/hoppscotch-common/src/components/smart/EnvInput.vue(+9 -3)📝
packages/hoppscotch-common/src/composables/codemirror.ts(+12 -0)➕
packages/hoppscotch-common/src/helpers/editor/extensions/HoppPredefinedVariables.ts(+142 -0)📝
packages/hoppscotch-common/src/newstore/environments.ts(+30 -8)📝
packages/hoppscotch-data/src/environment/index.ts(+23 -4)📝
packages/hoppscotch-data/src/index.ts(+1 -0)➕
packages/hoppscotch-data/src/predefinedVariables.ts(+370 -0)📄 Description
References
Closes HFE-549 #3317
Description
The idea is to introduce a feature similar to:
This feature is being built based on the work done for https://docs.hoppscotch.io/documentation/getting-started/rest/environment-variables.
Checks
Additional Information
Remarks
$guidwhile$guidis a predefined variable that computes to a random GUID, the request parser will use the predefined variable over your manually defined variable.Demonstration
This video demonstrates the use of a Predefined variable in Hoppscotch. At the first instance you will see a usage of a normal environment variable
myvar, and after that the video shows the use of a predefined variable called$nowIsowhich computes to the current time at the time of request. After that, the video also shows the usage of another predefined variable called$guidthat computes to a random GUID value (noting that for demonstrations purposed the GUID value is just a simple string random string).The video also shows a green border with green background on hover highlighting a valid predefined variable, while a red border with a red hover background is shown highlighting an invalid predefined variable. Hovering over a predefined variable name, a brief description is shown.
https://github.com/hoppscotch/hoppscotch/assets/25407841/df1b8f22-60aa-44dd-8b34-4480c0068abb
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.