Can this randomString(length) be reused in another pre-request script instead of having in each API request in postman?
function randomString(length){
var char ='';
while(chars.length < length ){
chars += Math.random().toString(36).substring(2);
}
returns chars.substring(0,length);
};
将它放在集合的预脚本中,然后它将在每个请求之前运行。
您可以将该函数存储在环境变量中,然后使用 eval() 函数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.