当前位置:网站首页>apipost脚本使用讲解一~全局变量
apipost脚本使用讲解一~全局变量
2022-06-27 21:06:00 【sik1】
一、全局变量 设置一个全局变量:apt.globals.set("key", "value"); 可以用apt.globals.set()设置一个自定义的值,如:apt.globals.set("test", "这是一个全局变量"); apt.globals.set()方法可以和request方法、response方法一起使用。 apt.globals.set()和request方法一起使用可以获取当前的请求:如 apt.globals.set("request", request);获取当前的请求详情 apt.globals.set("url", request.url);获取当前请求的url apt.globals.set("method", request.method);获取当前请求的method apt.globals.set("timeout", request.timeout);获取当前请求超时时间 apt.globals.set("contentType", request.contentType);获取当前请求的content-type apt.globals.set("bodys", request.request_bodys);获取当前的请求体 apt.globals.set("headers", request.request_headers);获取当前的请求头 apt.globals.set("querys", request.request_querys);获取当前请求的querys apt.globals.set()和response方法一起使用可以获取当前的响应:如 apt.globals.set("response", response);获取当前请求的响应 apt.globals.set("json", response.json);响应为json的时候,获取json格式的响应数据 apt.globals.set("headers", response.headers);获取当前的响应头 apt.globals.set("cookies", response.cookies);获取当前请求的响应cookie apt.globals.set("raw", response.raw);获取原始响应数据 apt.globals.set("status", response.raw.status);获取当前响应状态码(200、301、400等) apt.globals.set("responseTime", response.raw.responseTime);获取当前响应时间(毫秒) apt.globals.set("type", response.raw.type);获取当前响应类型(json等) apt.globals.set("responseText", response.raw.responseText);获取当前响应文本 Apipost官方链接:https://console.apipost.cn/register?utm_source=10008
边栏推荐
- 刚开始看英文文献,想问一下各位,最初应该怎么看进去?
- seata
- 小芯片chiplet技术杂谈
- The most illusory richest man in China is even more illusory
- 【数字IC/FPGA】检测最后一个匹配序列的位置
- 【剑指Offer】48. 最长不含重复字符的子字符串
- 【蓝桥杯集训100题】scratch数字计算 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第16题
- c语言之字符串数组
- Spug - 轻量级自动化运维平台
- The choice and trade-off between vector recall and literal recall
猜你喜欢

Structure de stockage des graphiques

【剑指Offer】47. 礼物的最大价值

Discuz taobaoke website template / Dean taobaoke shopping style commercial version template

Sentinel

How to set the enterprise wechat group robots to send messages regularly?

Small chip chiplet Technology

Summary of solutions to cross system data consistency problems

Liuleifeng, a "good man in Guangzhou" in the first quarter of 2022, has a strong sense of integrity and food safety

【tinyriscv verilator】分支移植到正点原子达芬奇开发板

【PCL自学:PCLVisualizer】点云可视化工具PCLVisualizer
随机推荐
未能加载文件或程序集“CefSharp.Core.Runtime.dll”或它的某一个依赖项。 不是有效的 Win32 应用程序。 (异常来自 HRESULT:0x800700C1)
Applet referer
Is the dog virtue training with a monthly salary of 30000 a good business?
Swing UI——容器(一)
[js]var, let,const 的区别
C WinForm reads the resources picture
CUDA error:out of memory caused by insufficient video memory of 6G graphics card
Practice torch FX: pytorch based model optimization quantization artifact
Netease cloud lost its "feelings" card
文献综述如何挑选文献进行阅读,比如我的检索结果有200多篇根本看不完,如何进行文献挑选呢?...
思源笔记订阅停止直接删云端数据嘛?
Classification of cifar-10 dataset with pytorch
The choice and trade-off between vector recall and literal recall
Senior headhunting team manager: interviewed 3000 consultants, summarized and organized 8 commonalities (Mao Sheng)
MSP430F5529 单片机 读取 GY-906 红外温度传感器
【PCL自学:Segmentation4】基于Min-Cut点云分割
【PCL自学:PCLPlotter】PCLPlotter绘制数据分析图
Discuz小鱼游戏风影传说商业GBK+UTF8版模板/DZ游戏网站模板
ICML 2022: UFRGS |作为最优策略转移基础的乐观线性支持和后继特征
pytorch基础(1)