Is there any way to delete/clear postman environment variable using functions at runtime. I could possibly set to blank or some special value but is there a general way of doing things.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Sandbox API pm.environment.unset(variableName)
also allows to do that.
In case is you want to clear all environment variables at once - you might want to do: pm.environment.clear()
.
This will clear all your environment values.
Refer: https://www.getpostman.com/docs/v6/postman/scripts/postman_sandbox_api_reference
回答2:
Ok - so this does it.
postman.clearEnvironmentVariable("key");
回答3:
And the right one syntax is:
pm.environment.unset("key");