当前位置:网站首页>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);
}
}
边栏推荐
- How to learn a new technology (programming language)
- 备库一直有延迟,查看mrp为wait_for_log,重启mrp后为apply_log但过一会又wait_for_log
- DNS 系列(一):为什么更新了 DNS 记录不生效?
- Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
- 【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
- 应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
- 玩转Sonar
- Leetcode brush questions
- STM32F1与STM32CubeIDE编程实例-旋转编码器驱动
- Coindesk comments on the decentralization process of the wave field: let people see the future of the Internet
猜你喜欢
How to insert highlighted code blocks in WPS and word
Service Mesh介绍,Istio概述
Is Zhou Hongyi, 52, still young?
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
[programming questions] [scratch Level 2] March 2019 garbage classification
1293_FreeRTOS中xTaskResumeAll()接口的实现分析
Binder核心API
Development of a horse tourism website (realization of login, registration and exit function)
5G NR 系统消息
某马旅游网站开发(登录注册退出功能的实现)
随机推荐
Smart regulation enters the market, where will meituan and other Internet service platforms go
Zhou Hongqi, 52 ans, est - il encore jeune?
Service Mesh介绍,Istio概述
3年经验,面试测试岗20K都拿不到了吗?这么坑?
Usage of limit and offset (Reprint)
詹姆斯·格雷克《信息简史》读后感记录
腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道
[programming problem] [scratch Level 2] 2019.09 make bat Challenge Game
Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
How does the markdown editor of CSDN input mathematical formulas--- Latex syntax summary
【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
The difference between get and post
How to learn a new technology (programming language)
Su embedded training - day4
How can CSDN indent the first line of a paragraph by 2 characters?
How to insert highlighted code blocks in WPS and word
redis你到底懂不懂之list
[研发人员必备]paddle 如何制作自己的数据集,并显示。
DNS 系列(一):为什么更新了 DNS 记录不生效?