PostMan生成广东医保Header内容

 

Pre-request Script

var xRioPaasid = 'test_hosp';
var secretKey = 'RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds';
var xRioTimestamp = Math.round(new Date().getTime()/1000).toString();
console.log(xRioTimestamp);
function randomString(len) {
    len = len || 32;
    var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
    var maxPos = $chars.length;
    var pwd = '';
    for (i = 0; i < len; i++) {
        pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
    }
    return pwd;
}
var xRioNonce = randomString(32);
console.log(xRioNonce);
var param = xRioTimestamp + secretKey  + xRioNonce + xRioTimestamp;
var xRioSignature = CryptoJS.SHA256(param).toString();
console.log(xRioSignature);
postman.setGlobalVariable('xRioPaasid', xRioPaasid);
postman.setGlobalVariable('xRioSignature', xRioSignature);
postman.setGlobalVariable('xRioTimestamp', xRioTimestamp);
postman.setGlobalVariable('xRioNonce', xRioNonce);Header

Header中添加

x-tif-paasid  {{xRioPaasid}}

x-tif-signature  {{xRioSignature}}

x-tif-timestamp {{xRioTimestamp}}

x-tif-nonce {{xRioNonce}}

 

posted @ 2022-11-14 14:33  随便取个名字算了  阅读(47)  评论(0编辑  收藏  举报