Apipost 如何自定义响应参数?

Apipost 支持在后执行脚本里对响应数据进行二次加工。例如你的响应内容如下:

你可以通过在接口的 后执行脚本 中,通过如下脚本使响应 json 中的 data.time 字段转换为格式化的日期。
复制代码
效果如下图:

底层原理
response.raw.responseText 代表的是响应的原始文本数据,我们主要是通过修改 response.raw.responseText 来实现响应结果的二次加工。
注意:
这种方法仅用于改变 Apipost 响应区的数据展示。不会实际影响断言、以及控制台的响应打印结果。
评论