mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #4944] [CLOSED] fix: 4672 whitespace vars codesnippet generation #4999
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#4999
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/4944
Author: @yousefmarey12
Created: 3/27/2025
Status: ❌ Closed
Base:
main← Head:4672-whitespace-vars-codesnippet-generation📝 Commits (4)
92e7e38fix(EffectiveURL.ts): used regular expressions to resolve environment variables4df956dfix(EffectiveURL.ts): used regular expressions to resolve environment variablese05996fMerge branch 'main' into 4672-whitespace-vars-codesnippet-generation3c41530Merge branch 'main' into 4672-whitespace-vars-codesnippet-generation📊 Changes
1 file changed (+80 additions, -20 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts(+80 -20)📄 Description
Fix: #4672
The issue stated that the problem was with whitespace in the values of environment variables caused the code snippet generation not to work. Using whitespace in environment variable values as query parameters did not work. The request endpoint ended up not escaping strings, so the endpoint was literally
http://example.com/query=<<variable>>. The problem wasn't really with whitespace as it was with dealing with environment variables in the url and parameters.What's changed
I changed 2 aspects: changing the literal endpoint and modifying how params are computed. For params, it checks if there even is
SOMETHING=<<VALUE>>and replaces the variable with its value. For the endpoint, it just replaces<<VARIABLE>>with its value without the<< >>.Notes to reviewers
What's of my concern is that I had to make
sourceEnvan empty string, in which it is never an empty string (you can't have a variable in an empty string folder). There is also thesource: authand this PR has nothing to do with authentication, but I had to put it as it was a constant.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
estranslation #5011