当前位置:网站首页>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);
}
}边栏推荐
- ABAP ALV LVC template
- 5g NR system messages
- 服务器防御DDOS的方法,杭州高防IP段103.219.39.x
- 52岁的周鸿祎,还年轻吗?
- Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
- paddle一个由三个卷积层组成的网络完成cifar10数据集的图像分类任务
- [basis of recommendation system] sampling and construction of positive and negative samples
- fabulous! How does idea open multiple projects in a single window?
- 5G NR 系统消息
- Zhou Hongqi, 52 ans, est - il encore jeune?
猜你喜欢

大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?

Relevant methods of sorting arrays in JS (if you want to understand arrays, it's enough to read this article)

Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet

Play sonar
![[programming problem] [scratch Level 2] draw ten squares in December 2019](/img/4f/14ea8e786b7f8b0a263aa5c55abf15.png)
[programming problem] [scratch Level 2] draw ten squares in December 2019

They gathered at the 2022 ecug con just for "China's technological power"

腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道

5G NR 系统消息

某马旅游网站开发(登录注册退出功能的实现)

Is 35 really a career crisis? No, my skills are accumulating, and the more I eat, the better
随机推荐
Reentrantlock fair lock source code Chapter 0
An error is reported during the process of setting up ADG. Rman-03009 ora-03113
赞!idea 如何单窗口打开多个项目?
Notice on organizing the second round of the Southwest Division (Sichuan) of the 2021-2022 National Youth electronic information intelligent innovation competition
new和delete的底层原理以及模板
智慧监管入场,美团等互联网服务平台何去何从
3 years of experience, can't you get 20K for the interview and test post? Such a hole?
v-for遍历元素样式失效
韦东山第二期课程内容概要
3年经验,面试测试岗20K都拿不到了吗?这么坑?
【obs】Impossible to find entrance point CreateDirect3D11DeviceFromDXGIDevice
单机高并发模型设计
Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet
Lecture 1: the entry node of the link in the linked list
52岁的周鸿祎,还年轻吗?
詹姆斯·格雷克《信息简史》读后感记录
语义分割模型库segmentation_models_pytorch的详细使用介绍
“一个优秀程序员可抵五个普通程序员”,差距就在这7个关键点
The difference between get and post
What if the testing process is not perfect and the development is not active?