0

通过Postman中的Interceptor调用 API 并从响应正文中获取Cookie成为可能。

通过这种方式做到了:https://www.linkedin.com/pulse/how-read-cookie-value-postman-request-chaining-ishan-girdhar-oscp

但是,如果我尝试从Newman命令行实现相同的功能,它会给我一个错误,因为 CI 中没有涉及拦截器(POSTMAN + JENKINS)

试图通过这个链接,但它没有多大帮助:https://github.com/postmanlabs/newman/issues/242

请建议我在通过纽曼运行时读取 cookie 的方法!

非常感谢!

4

1 回答 1

0

使用 newman 作为 Node JS 模块,而不是从命令行。

cookie 在发送到“请求”事件的对象中可用。

const newman = require('newman');

newman.run(options,callback)
.on('request',function(err,args) {
  console.log(args.response.cookie);
})
于 2017-09-29T20:42:10.707 回答