Tag: node https

Trello响应“无效的密钥”

我正在尝试使用以下URL使用Node.js的https模块获取Trello板的JSON数据: https://trello.com/b/nC8QJJoZ.json 这是我的代码: var https = require('https'); https.get('https://trello.com/b/nC8QJJoZ.json', function (res) { console.log('statusCode:', res.statusCode); console.log('headers:'); console.log(res.headers); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log(chunk); }); }).on('error', function (e) { console.log('ERROR: ' + e); }); 尽pipeURL在浏览器中完美工作,但它返回一个包含string“invalid key”的主体,其状态为401。 以下是输出: statusCode: 401 headers: { 'cache-control': 'max-age=0, must-revalidate, no-cache, no-store', 'x-content-type-options': 'nosniff', 'strict-transport-security': 'max-age=15768000', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'DENY', 'x-trello-version': '1.430.0', 'x-trello-environment': […]