美文网首页
Pre-request Script常用代码

Pre-request Script常用代码

作者: lalalasa | 来源:发表于2020-06-08 13:12 被阅读0次
//设置环境变量
pm.globles.set(key, value);  

//发送一个请求
pm.sendRequest("http://www.baidu.com", function(err, response){
console.log(response.json());
});  

// js数组长度
var arr =['aa','dd','bb','cc'];
console.log(arr.length);

//查看变量字符类型

有几个比较有意思的用法,如果使用postman做自动化工具,这几个语法可以参考使用

//设置下一步被执行的请求
postman.setNextRequest("request_name");

参考文档:https://learning.postman.com/docs/postman/scripts/postman-sandbox-api-reference/

相关文章

网友评论

      本文标题:Pre-request Script常用代码

      本文链接:https://www.haomeiwen.com/subject/syhnyhtx.html