预执行脚本语法:
//生成随机手机号
function generatePhone() {
var prefixArray = ['130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '147', '150', '151', '152', '153', '155', '156', '157', '158', '159', '186', '187', '188', '189'];
var prefix = prefixArray[Math.floor(Math.random() * prefixArray.length)];
var suffix = '';
for (var i = 0; i < 8; i++) {
suffix += Math.floor(Math.random() * 10);
}
return prefix + suffix;
}
console.log(generatePhone());
预执行脚本在设置到body中:
apt.setRequestBody("Phone", generatePhone());
更多Apipost小知识小技巧,请在首页扫码加入我们的技术群吧~~~