【问题标题】:Unable to Read Cookie values from Newman - Jenkins CI无法从 Newman 读取 Cookie 值 - Jenkins CI
【发布时间】:2019-01-11 15:31:38
【问题描述】:

通过 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

请建议我在运行 Newman 时读取 cookie 的方法!

非常感谢!

【问题讨论】:

    标签: javascript jenkins postman newman


    【解决方案1】:

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

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

    const newman = require('newman');
    
    newman.run(options,callback)
    .on('request',function(err,args) {
      console.log(args.response.cookie);
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多