-
-
Notifications
You must be signed in to change notification settings - Fork 102
Export route parameters as path variables #55
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
Conversation
`{param}` becomes `{{param}}` and will match on variables defined for the given Postman environment.
Co-authored-by: Tom Irons <[email protected]>
@johnnybenson I'm confused on the use case for this PR. Converting the url parameters to a postman variable doesn't make much sense. I have a couple clarifying questions for you.
|
Ahh cool, I didn't realize Postman gave us path variables. That's clearly much better. $routeStr = str_replace(['}', '{'], ['', ':'], $route->uri()); Want me to update the PR with something like the above? FWIW, the UI doesn't highlight path variables for some reason. It's been a while since I've used Postman too. Thanks for the help and the very useful feedback! |
Yeah, you can update this PR to do that. I wish they had a better way of highlighting the path variables too. |
After comparing this to how postman exports collection, there are a couple more things that need to be ironed out.
|
{
"name": "api/v1/chunks/{address}",
"request": {
"method": "GET",
"header": [
{ "key": "Accept", "value": "application/json" },
{ "key": "Content-Type", "value": "application/json" }
],
"url": {
"raw": "{{base_url}}/api/v1/chunks/:address",
"host": "{{base_url}}/api/v1/chunks/:address",
"path": ["api", "v1", "chunks", ":address"],
"variable": [{
"key": "address",
"value": ""
}]
}
}
} |
@johnnybenson I've refactored this whole thing, please take it for a test run and let me know if any issues arise. I did not test this locally. 😅 |
Your version looks much better :) thanks. Testing locally, we also need to replace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! ❤️
Thank you @johnnybenson for the contribution, and @tomirons for the refactoring ❤️ |
{param}
becomes{{param}}
and will match on variables defined for the given Postman environment.