0


postman sign签名和时间戳

一、设置全局变量

二、Body中引用全局变量

{

"clientId": "15812345678",

"timestamp": "{{timestamp}}",

"sign": "{{sign}}",

"openId": "1",

"appid":"appid1",

"dataParams": {

    "name":"111"

}

}

三、脚本代码

//let param = request.data; //post 参数

//let queryParam = pm.request.url.query.members; //get中的参数

//pm.request.addQueryParams("time=" + (new Date()).getTime().toString());

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

let jsonObj = {"clientId":"15812345678","privateKey":"123456","timestamp":timestamp};

let jsonStr = JSON.stringify(jsonObj);

// console.log(jsonStr);

let md5Str = CryptoJS.MD5(jsonStr).toString().toUpperCase();

// console.log(md5Str);

// 设置时间戳

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

// 设置签名

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

标签: postman

本文转载自: https://blog.csdn.net/qq_34276316/article/details/130587016
版权归原作者 雨落星辰C 所有, 如有侵权,请联系我们删除。

“postman sign签名和时间戳”的评论:

还没有评论