Closed Chia-Yu-hung closed 3 years ago
Hi @Chia-Yu-hung,
First thanks so much for your support :-) but... Pull request shoul contain only one feature please and also test that cover the new code.
The #76 is work in progress and not only for path variables but for all variables in a postman collection, never mind the position, so please don't include this as part of the pull as is already being developed and is double effort, thanks!
Best regards
Hi @joolfe,
Thanks for your reply, I will fix your comment and push again~
I will separate :params
and -g to two branch, and also test that cover then.
Best regards
Hi @Chia-Yu-hung,
About the -g option as I already mention this feature is not needed the #76 issue is work in progress and already cover this feature with an option parameter.
Best Regards.
Hi @joolfe, About #134 how did I bring the global variable ? because I export the postman global environment json, format like below
"name": "Local",
"values": [
{
"key": "url",
"value": "http://127.0.0.1:8888",
"enabled": true
},
{
"key": "project",
"value": "default",
"enabled": true
}
]
mean I need replace values
to additionalVars
and set replaceVars
true, so that I can replace the {{variable}}
?
btw, If I used this method to replace {{variable}}
in all file, api path also will be replaced, this is expected?
Best Regards.
Hi @Chia-Yu-hung,
Please have a look to the documentation about the new feature that replace vars, if you have additional questions I think a issue is better than a pull request for that discussion.
mean I need replace values to additionalVars and set replaceVars true, so that I can replace the {{variable}} ?
Variable replacement has a performance cost for this reason you need to explicitly activate this when process the postman collection using the option replaceVars: true
, by default the library get the variables that are stored in the postman collection file in the field variable
, this are the ones that Postman docs call collection variables but as there are many other scopes in postman as Global, Environment, Data, Local... there are an additional way to provide variable values for replacing the option additionalVars
that is just a json object with key/value pairs.
btw, If I used this method to replace {{variable}} in all file, api path also will be replaced, this is expected?
To avoid some variable to be replace just don´t pass a key/value for this variable, I mean, if you don't want to replace a path variable {{user_id}}
just don´t pass a variable with a value, this is a deliberate behaviour implemented to avoid this kind of use cases.
Best Regards.
Can use Path Variables
:param
in postman.Can replace
{{variable}}
with real value by use global environment json file.-g
add this file, that can replace the{{variable}}
to real value.