当前位置:网站首页>Interface test advanced interface script use - apipost (pre / post execution script)
Interface test advanced interface script use - apipost (pre / post execution script)
2022-07-08 00:35:00 【InfoQ】
- To write JS Functions to achieve complex calculations ;
- Variable printing
- Definition 、 obtain 、 Delete 、 Clear environment variables
- Definition 、 obtain 、 Delete 、 Clear global variables
- Get request parameters
- Dynamic addition 、 Delete one header Request parameters
- Dynamic addition 、 Delete one query Request parameters
- Dynamic addition 、 Delete one body Request parameters
- send out HTTP request
function _random(){
return ' Hello , China ' + Math.random();
}
apt.globals.set("random_var", _random());
apt.variables.set("key", "value"); // Set a value to value Environment variables of key
apt.variables.get("key"); // Get environment variables key Value
apt.variables.delete("key"); // Delete environment variables key
apt.variables.clear(); // Clear all defined environment variables
apt.globals.set("key", "value"); // Set a value to value Global variable of key
apt.globals.get("key"); // Set a value to value Global variable of key
apt.globals.delete("key"); // Set a value to value Global variable of key
apt.globals.clear(); // Clear all defined global variables
apt.setRequestHeader("key", "value"); // Dynamically add a key to key The value is value Of header Parameters
apt.removeRequestHeader("key"); // Delete header The key in the parameter is key Parameters of
apt.setRequestQuery("key", "value"); // Dynamically add a key to key The value is value Of query Parameters
apt.removeRequestQuery("key"); // Delete query The key in the parameter is key Parameters of
apt.setRequestBody("key", "value");// Dynamically add a key to key The value is value Of body Parameters Only aim at form-data、urlencode It works
apt.removeRequestBody("key");// Delete body The middle key is key Parameters of Only aim at form-data、urlencode It works
$.ajax({
url:"https://echo.apipost.cn/get.php",
method:"POST",
headers:{
"content-type":"application/json"
},
timeout:"10000",
async:false, // Remember that this is set to false, The request must be synchronized
data:JSON.stringify({"email":"[email protected]","password":"123456"}),
success:function (response) {
apt.globals.set("bigint",response.bigint);
}
}
边栏推荐
- 【转载】解决conda安装pytorch过慢的问题
- Zhou Hongqi, 52 ans, est - il encore jeune?
- Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
- 【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
- 《因果性Causality》教程,哥本哈根大学Jonas Peters讲授
- 测试流程不完善,又遇到不积极的开发怎么办?
- paddle入门-使用LeNet在MNIST实现图像分类方法一
- Development of a horse tourism website (optimization of servlet)
- v-for遍历元素样式失效
- Reading notes 004: Wang Yangming's quotations
猜你喜欢
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
备库一直有延迟,查看mrp为wait_for_log,重启mrp后为apply_log但过一会又wait_for_log
Installation and configuration of sublime Text3
What if the testing process is not perfect and the development is not active?
RPA云电脑,让RPA开箱即用算力无限?
The standby database has been delayed. Check that the MRP is wait_ for_ Log, apply after restarting MRP_ Log but wait again later_ for_ log
C language 001: download, install, create the first C project and execute the first C language program of CodeBlocks
Jouer sonar
SDNU_ACM_ICPC_2022_Summer_Practice(1~2)
Single machine high concurrency model design
随机推荐
How to measure whether the product is "just needed, high frequency, pain points"
RPA云电脑,让RPA开箱即用算力无限?
Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
v-for遍历元素样式失效
攻防世界Web进阶区unserialize3题解
[programming problem] [scratch Level 2] draw ten squares in December 2019
Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet
Trust orbtk development issues 2022
[OBS] the official configuration is use_ GPU_ Priority effect is true
第一讲:链表中环的入口结点
51与蓝牙模块通讯,51驱动蓝牙APP点灯
他们齐聚 2022 ECUG Con,只为「中国技术力量」
接口测试要测试什么?
Smart regulation enters the market, where will meituan and other Internet service platforms go
Hotel
tourist的NTT模板
语义分割模型库segmentation_models_pytorch的详细使用介绍
ReentrantLock 公平锁源码 第0篇
搭建ADG过程中复制报错 RMAN-03009 ORA-03113
接口测试进阶接口脚本使用—apipost(预/后执行脚本)