【发布时间】:2017-02-25 02:48:20
【问题描述】:
使用 POSTMAN,一切都很好:
我将相同的标头、参数、...传递给 superagent,如下所示:
const superagent = require('superagent');
const grab = require('ps-grab');
superagent.get('https://x.rathath.net/issue_statuses.json')
.set({
'Accept': 'application/json',
'Content-Type': 'application/json'
})
.auth(grab('--user'),grab('--password'))
.send({})
.end((error,response)=>{
console.log(response.text);
});
但是失败了!
我有疑问: superagent+Authorization Header+ OSX .. 我的意思是这三个的兼容性。
确实,我在 Redhat 机器上运行了相同的 javascript sn-p,它运行良好。
【问题讨论】:
标签: basic-authentication darwin superagent