3--Postman--變數(environment&global)
阿新 • • 發佈:2018-11-30
(1) Environment
clear an environment variable: pm.environment.unset("variable_key")--recommend postman.clearEnvironmentVariable(variableName) postman.clearEnvironmentVariables() get an environment variable: pm.environment.get("variable_key")--recommend postman.getEnvironmentVariable(variableName) set an environment variable
(4) Get a variable
This function searches for the variable across globals and the active environment.
pm.variables.get("variable_key");
(5) Dynamic variables
Note that dynamic variables cannot be used in the Sandbox. You can only use them in the {{..}} format in the request URL / headers / body.