2017-07-08 34 views
1

在郵遞員發送憑據安裝登錄身體部分x-www-form-ulrencoded。這工作絕對好。郵差:紐曼收集亞軍無法發送身體呼叫形式URL編碼參數

在newman集合運行器中導出此腳本後,這不起作用。

以下是輸出:

------------------------------------------------------------------------------------------- 
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"} 

此外,當我從郵遞員生成捲曲代碼我沒有看到附着在用戶/ 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' 

使用郵差Chrome應用:

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

我發現的是,紐曼跨越發送到服務器之前將刪除URL編碼體的參數。任何線索? – BabyGroot

回答

1

所以在這裏的問題是安裝了紐曼的版本。 所以我得到了最新版:

//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.