mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #834] URL Path Parameters #293
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#293
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?
Originally created by @sboulema on GitHub (May 1, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/834
Is your feature request related to a problem? Please describe.
I am trying to convert from Postman to Postwoman. I love that I have a proper API testing tool that I can use on my laptop and on my phone and keep everything in sync!
I do however miss the easy way of setting url path parameters as is possible in Postman.
Describe the solution you'd like
More info on how path parameters work in Postman:
https://learning.postman.com/docs/postman/sending-api-requests/requests/#sending-parameters
Describe alternatives you've considered
Either a similar solution with a special character or maybe a dropdown next to the current query parameters to indicate if it is a query or path parameter.
@liyasthomas commented on GitHub (May 1, 2020):
Hi @sboulema, Glad you're making use of PW.
There's also another way to append parameters that is to append parameters along the URL itself. Ex:
https://httpbin.org/get?param1=true¶m2=falseYou can even use
Pre-request scriptsto add/remove parametersRead more on
Pre-request scripts: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-Scripts.Hope issue is solved.
@sboulema commented on GitHub (May 1, 2020):
Thanks for the quick response!
Those parameters are added as query parameters though. I am looking for adding a parameter as part of the url path.
/petstore/pet/:petId
With a parameter petId defined as 42 for example.
Would lead to: /petstore/pet/42 as url.
The current parameters would give me:
/petstore/pet?petId=42 as url.
@liyasthomas commented on GitHub (May 1, 2020):
Yep, that's why we've
Pre-request scriptswhich can be use to set environment variable. Check Environments Tab in right sidebar to add/export/import envs.Read more on
Pre-request scripts: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-ScriptsWe use
<<>>angle-braces (instead of{{}}in Postman) to represent env variables.@sboulema commented on GitHub (May 1, 2020):
Ah, missed that! Thank you very much 😃
@liyasthomas commented on GitHub (May 1, 2020):
Disclaimer: I'm too busy living my life I fairly have no enough time to improve the Environment flow. 😄
There'll be bugs. Let me know if you stumbled upon any bugs.
@sboulema commented on GitHub (May 1, 2020):
Have a problem I am running into...
I set my petId as an env variable using the prerequest script. But now I can't select an env from the list to set other variables cause it would overwrite my request specific env variable.
Production environment:
<<PetstoreHost>>Request env variable:
<<PetId>>So either I end up with an environment with all path variables for all endpoints, or an environment foreach endpoint...
Would be nice if the environment appends to the prerequest script instead of overwrite if there are request specific variables. Or the request variables should be saved/configured elsewhere?
Thanks for all the hard work and real life is way more important!
@liyasthomas commented on GitHub (May 1, 2020):
Do you believe overwriting current env should be the default action? It's easily possible to append vars to current env - but I suspect everybody should not be expecting that behaviour.
An environment with all path variables for all endpoints would be my choice. Anyways, I'm all ears, open for suggestions.
@sboulema commented on GitHub (May 2, 2020):
That was a fun saturday!
I wrote a possible solution to the problem:
github.com/sboulema/postwoman@25f014ef3bIt adds a type dropdown to the current parameter list. Based on the type, the parameter either gets included as a query parameter or gets added as an environment variable so it can be used in the current url path template replacement.
Parameters without a type are treated as query parameters so the implementation is backwards-compatible.
This way the parameter gets saved with the request and does not have to be saved with the environment.
Any thoughts or comments ?
If you want I can submit a PR 👍
@liyasthomas commented on GitHub (May 3, 2020):
@sboulema implementation looks good to me. shoot the PR 🚀