Postman 扩展从响应 header 或正文设置环境变量

标签 postman

Postman 扩展具有从响应头或正文中的值之一设置环境变量的功能。更新后不见了。有人可以在这里帮忙吗。

最佳答案

您可以从响应正文/ header 设置环境变量,如下所示:
来自响应正文:

var body = JSON.parse(responseBody);

postman.setEnvironmentVariable("[environmentVariable]", body.variableName);
来自响应头:
var headerName = responseHeaders.headerName;

postman.setEnvironmentVariable("[environmentVariable]", headerName);

关于Postman 扩展从响应 header 或正文设置环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40906579/

相关文章:

google-apps-script - 尝试在 GAS doPOST 中使用开发模式

php - application/json 所有请求都转到 403

Postman - 仅在多个请求*多次迭代的情况下执行第一次迭代的第一个请求

javascript - 在集合中的整个请求中将 Postman header 值保存到变量中

ubuntu - 如何在 Ubuntu 上安装 Postman Native?

timestamp - 如何在 postman 请求中添加时间戳?

rest - Twitter 过滤流在 POSTMAN 中返回空输出

node.js - postman 发送原始 JSON 帖子的奇怪响应( Node js)

postman - 在Postman中定义多个变量和初始值

cookies - 如何生成有效的 Cookie