关注互联网应用及运维技术的个人博客

postman级联查询案例

/解析返回值
var res = JSON.parse(responseBody);

var apiSalt = res.apiSalt;
var serviceSalt = res.serviceSalt;

var redPacketActivityId = pm.environment.get("activityId");
//获取postman变量
var token = pm.environment.get("token");
var userId = pm.environment.get("userId");
//设置postman变量
pm.environment.set("apiSalt",res.apiSalt);
pm.environment.set("serviceSalt",res.serviceSalt);
//apiSalt=4&redPacketActivityId=3&serviceSalt=5&token=1&userId=2
var param = `apiSalt=${apiSalt}&redPacketActivityId=${redPacketActivityId}&serviceSalt=${serviceSalt}&token=${token}&userId=${userId}${apiSalt}`;

pm.environment.set("param",param);

var sign = CryptoJS.MD5(param).toString();

pm.environment.set("sign",sign);

pm postman固定常量
pm.environment postman参数设置

1.新增变量:

2.变量调用

赞(0)
未经允许不得转载:飞天狒狒 » postman级联查询案例

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址