简体   繁体   English

如何在postman中自动设置token

[英]how to set token automatically in postman

Want to set token automatically in postman. On a login Api call set token in postman automatically.想要在 postman 中自动设置令牌。在登录 Api 中自动调用 postman 中的设置令牌。 want to clear then postman variable and set new token given by as Api response然后想清除 postman 变量并设置由 Api 响应给出的新令牌

  1. Set the token variable in collection ver in postman.在 postman 集合 ver 中设置 token 变量。
  2. write the given code in api test part在 api 测试部分编写给定的代码
pm.collectionVariables.unset("<token _name>");
pm.collectionVariables.set("<token_name>", pm.response.text());
  1. run api运行 api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM