首页 文章

邮差:纽曼收集运动员无法通过电话在身体中发送表格 url-encoded 参数

提问于
浏览
1

在邮递员发送凭据设置登录身体部分 x-www-form-ulrencoded。这绝对没问题。

在 newman collection runner 中导出此脚本后,这不起作用。

以下是输出:

-------------------------------------------------------------------------------------------
401 3361ms Login Call [POST] https://<url>/login
------------------------------------------------------------
Request headers:
{
 "content-type": "application/x-www-form-urlencoded",
 "host": "<url>",
 "accept-encoding": "gzip, deflate",
 "content-length": 0
}
Request data:
{
  "userid": "user",
  "password": "pswd"
}
------------------------------------------------------------
Response headers:
{
 "x-frame-options": "SAMEORIGIN",
 "content-type": "application/json",
 "x-content-type-options": "nosniff",
 "date": "...",
 "cache-control": "no-cache",
 "content-length": "120",
 "x-xss-protection": "1; mode=block",
 "connection": "close",
 "accept-ranges": "bytes"
}
Response body:
{"errorCode":"401","errorMessage":"Login failed, please check the credentials","errorDescription":"API Request Failure"}

此外,当我从邮递员生成卷曲代码时,我没有看到 user/pswd 标头附加:

curl -X POST \
  https://<url>/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 5b04e538-498c-9e43-2be9-8523073260f9'

使用 Postman Chrome 应用:

Postman for Chrome
Version 5.0.2
win / x86-64
Chrome 59.0.3071.115

1 回答

  • 1

    所以这里的问题是 Newman 的安装版本。所以我得到了最新版本:

    //to install
    npm install -g newman
    
    //needed to use Newman.run instead of Newman.execute
    newman run c:\s -e c:\env --reporters cli,json --reporter-json-export c:\out.json -k
    
    //-k was required to bypass ssl security issues.
    

相关问题