1
//如果是post请求,则需转成base64 if(runapi.getMethod() == 'post'){ var all_param = runapi.getAllParam();
//处理参数
var post_data={};
for(var i = 0; i < all_param.length; i++){
index = all_param[i]['name']
if(index!=''){
if(runapi.getParam(index) == "{{USERNAME}}"){
post_data[index] = runapi.getVar("USERNAME")
}else{
post_data[index] = runapi.getParam(index)
}
//runapi.moveParam(index) 在这里执行方法去除掉不提交
}
}
//转成json字符串后再进行base64编码
var post_json = JSON.stringify(post_data);
var base64_data = runapi.CryptoJS.enc.Utf8.parse(post_json ).toString(runapi.CryptoJS.enc.Base64);
runapi.setParam("base64_data",base64_data )
}