当前位置:网站首页>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);
}
}边栏推荐
- Is 35 really a career crisis? No, my skills are accumulating, and the more I eat, the better
- v-for遍历元素样式失效
- Common selectors are
- Basic principle and usage of dynamic library, -fpic option context
- 华泰证券官方网站开户安全吗?
- NVIDIA Jetson测试安装yolox过程记录
- 22年秋招心得
- 【obs】Impossible to find entrance point CreateDirect3D11DeviceFromDXGIDevice
- QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
- They gathered at the 2022 ecug con just for "China's technological power"
猜你喜欢

“一个优秀程序员可抵五个普通程序员”,差距就在这7个关键点

SDNU_ACM_ICPC_2022_Summer_Practice(1~2)

Tencent security released the white paper on BOT Management | interpreting BOT attacks and exploring ways to protect

测试流程不完善,又遇到不积极的开发怎么办?

【GO记录】从零开始GO语言——用GO语言做一个示波器(一)GO语言基础

paddle一个由三个卷积层组成的网络完成cifar10数据集的图像分类任务

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

SQL knowledge summary 004: Postgres terminal command summary

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

What has happened from server to cloud hosting?
随机推荐
智慧监管入场,美团等互联网服务平台何去何从
Leetcode brush questions
【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
redis你到底懂不懂之list
The difference between -s and -d when downloading packages using NPM
手写一个模拟的ReentrantLock
51 communicates with the Bluetooth module, and 51 drives the Bluetooth app to light up
Qt不同类之间建立信号槽,并传递参数
Kubernetes Static Pod (静态Pod)
Su embedded training - day4
测试流程不完善,又遇到不积极的开发怎么办?
How to measure whether the product is "just needed, high frequency, pain points"
华为交换机S5735S-L24T4S-QA2无法telnet远程访问
爬虫实战(八):爬表情包
Scrapy framework
Su embedded training - Day3
【obs】官方是配置USE_GPU_PRIORITY 效果为TRUE的
Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知
华泰证券官方网站开户安全吗?
ABAP ALV LVC模板