postman md5加密传输

let timestamp = (new Date()).getTime().toString(); 
timestamp = timestamp.substr(0,10);
//设置集合的全局变量
pm.collectionVariables.set("timestamp", timestamp);

var key='LinkDuoo.Sign';
var signStr = key + timestamp;

console.log("signStr :"+signStr);

//md5加密

var signature=CryptoJS.MD5(signStr).toString();
console.log("signature:"+signature);
pm.collectionVariables.set("signature", signature);

//获取当前时间

let timestamp = (new Date()).getTime().toString(); 

//取前十位

timestamp = timestamp.substr(0,10);

pm.globals.set("timestamp", timestamp);

//md5加密字符串

key = postman.getGlobalVariable("YuOu.Momtime.Sign");

var strmd5 = CryptoJS.MD5(key+timestamp).toString();

pm.globals.set("signature", strmd5);

//获取当前时间
let timestamp = (new Date()).getTime().toString(); 
//取前十位
timestamp = timestamp.substr(0,10);
pm.globals.set("timestamp", timestamp);
//md5加密字符串
key = postman.getGlobalVariable("YuOu.Momtime.Sign");
var strmd5 = CryptoJS.MD5(key+timestamp).toString();
pm.globals.set("signature", strmd5);

你可能感兴趣的:(postman,postman,测试工具)