const appid = pm.request.headers.get("appid");
const appkey = pm.request.headers.get("appkey");
const method = pm.request.headers.get('method');
console.log(appid)
console.log(method)
const raw = pm.request.body.raw;
const sign = CryptoJS.MD5(appid + raw + appkey).toString().toUpperCase();
const body = {
'header': { 'appid': appid, 'sign': sign },
'body': raw,
};
if (method) {
body['header']['method'] = method;
}
console.log(body)
const wordArray = CryptoJS.enc.Utf8.parse(JSON.stringify(body));
const base64 = CryptoJS.enc.Base64.stringify(wordArray);
pm.request.body.raw = 'data=' + encodeURIComponent(base64);
// 设置 Headers
pm.request.headers.add({ 'key': 'Content-Type', 'value': 'application/x-www-form-urlencoded' });