国产接口调试工具 ApiPost 中的内置变量
APIPOST 内置系统变量
APIPOST 内置系统变量包含 request 对象和 response 对象。
request 对象
一个请求的所有请求参数组成的对象。我们在预执行脚本可以打印查看并使用该变量。

如上图所示,该对象的结构如下:

我们可以通过此对象,在脚本中获取当前的 API 请求的请求参数信息,从而实现达到我们的一些目的。
response 对象
一个请求所有的响应参数组成的对象。只能用于后执行脚本(发送了才有响应)。我们在后执行脚本可以打印查看并使用该变量。

该对象的对应结构如下:
response.raw:原始响应数据
调用示例:
复制代码
response.json:json 格式的响应数据

调用示例如上面示例:
复制代码
response.headers:响应头

调用示例:
复制代码
response.cookies :响应 cookie

调用示例:
复制代码
评论