当前位置:网站首页>Interface test advanced interface script using -apipost (pre/post execution script)
Interface test advanced interface script using -apipost (pre/post execution script)
2022-08-10 18:19:00 【InfoQ】

- Write JS functions to realize complex calculations;
- Printing of variables
- Define, get, delete, clear environment variables
- Define, get, delete, clear global variables
- Get request parameters
- dynamically add or delete a header request parameter
- dynamically add or delete a query request parameter
- Dynamicly add or delete a body request parameter
- Send HTTPRequest

function _random(){
return 'Hello, China' + Math.random();
}apt.globals.set("random_var", _random());
apt.variables.set("key", "value"); //Set an environment variable key
apt.variables.get("key"); // Get the value of the environment variable key
apt.variables.delete("key"); //Delete the environment variable key
apt.variables.clear(); // Clear all defined environment variablesapt.globals.set("key", "value"); //SetA global variable key
apt.globals.get("key"); //Set a global variable key
apt.globals.delete("key"); //Set a global variable key with value value
apt.globals.clear(); //Clear all defined global variablesapt.setRequestHeader("key", "value"); // Dynamically add a header whose key is key and value is valueParameters
apt.removeRequestHeader("key"); //Remove the parameter whose key is key in the header parameterapt.setRequestQuery("key", "value"); // Dynamically add a query parameter whose key is key and value is value
apt.removeRequestQuery("key"); //Remove the key in the query parameter as keyThe parameters apt.setRequestBody("key", "value");// Dynamically add a key as the key valueThe body parameter is only valid for form-data and urlencode
apt.removeRequestBody("key");//Remove the parameter whose key is key in the body Only valid for form-data and urlencode$.ajax({
url:"https://echo.apipost.cn/get.php",
method:"POST",
headers:{
"content-type":"application/json"
},
timeout:"10000",
async:false, // remember thisIf the item 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);
}
}边栏推荐
- CAS客户端对接
- 产品-Axure9英文版,A页面内a1状态跳转B页面的b2状态,(条件跳转状态)
- redis分布式锁
- 多线程与高并发(五)—— 源码解析 ReentrantLock
- R语言ggplot2可视化:使用ggpubr包的text_grob函数和as_ggplot函数可视化文本段落(将指定文本段落可视化出来、指定文本段可视化为图像)、face参数指定文本的字体样式
- 海思HI3516DV300开发资料
- 机器人控制器编程实践指导书旧版-实践八 机器人综合设计
- 多线程与高并发(11)——经典面试题之实现一个容器,提供两个方法,add,size。
- 机器人控制器编程整理汇总-辞旧迎新-
- Wuling Hongguang MINI EV, the only drawback is safety
猜你喜欢

Live Review|How to build an enterprise-level cloud management platform in the multi-cloud era?(with the download of the construction guide)

【图像分割】基于元胞自动机实现图像分割附matlab代码

机器人控制器编程实践指导书旧版-实践三 直流电机(执行器)

机器人控制器编程实践指导书旧版-实践八 机器人综合设计

1001 A+B Format (string processing)

【HMS core】【FAQ】Account Kit、push Kit典型问题合集1

【2011】【论文笔记】用THz-TDS观察水树——

【HMS core】【FAQ】Analytics Kit、Push Kit典型问题合集3

Toronto Research Chemicals萜烯分析丨(+)-柠檬烯

机器人控制器编程实践指导书旧版-实践七 无线通信(网络)
随机推荐
Active users of mobile banking grew rapidly in June, hitting a half-year high
Colocate Join :ClickHouse的一种高性能分布式join查询模型
不能直接在交易所期货开户
组合模式
三星Galaxy Watch5产品图片流出 非Pro表款亦有蓝宝石加持
开发模式对测试的影响
CSV(Comma-Separate-Values)逗号分隔值文件
[JMeter]Beanshell解析Json格式的接口响应数据
迪文发布新款2K高清DGUS智能屏
HarmonyOS自动化测试框架—Hypium
H3C_堆叠(IRF)及链路聚合在项目中的综合应用
关于技术分享的思考
文档标题能否支持公式
定时器循环展示数组
破解校园数字安全难点,联想推出智慧教育安全体系
【2015】【论文笔记】等离子光混合器THz辐射的光谱——
FlexSim仿真软件入门笔记:基本操作、快捷键
【图像去雾】基于颜色衰减先验的图像去雾附matlab代码
unity 坑坑001
leet面试150