我正在编写一个node.js应用程序,它向pingdom发出get请求;但是一直收到“用户凭据丢失错误”的消息,尽管我试着把它放在所有地方。请参阅下面的代码。
function get_checks() {
var options = {
"hostname" : "api.pingdom.com",
"path" : "/api/2.0/checks?"+"userpwd=user@example.com"+":"+"password",
"method" : "GET",
"headers" : {
"userpwd" : "user@example.com"+":"+"password",
"App-Key" : "key"
},
"userpwd" : "user@example.com"+":"+"password"
};
var req = https.request(options, function(response){
response.on('data', function(response_data) {
console.log("Response: " + response_data);
});
});
req.end();
}发布于 2012-08-03 08:07:32
我自己回答这个问题,这样它就不会悬而未决...
pingdom使用http基本身份验证,因此它必须在身份验证头中。
https://stackoverflow.com/questions/10340230
复制相似问题