1
我想使用meteor.http模塊,我在服務器端收到以下錯誤。 「錯誤:主機名/ IP與證書的altnames不匹配」,因爲我是Meteor和Node.js中的新手,並且它的javaScript調試很難(順便說一句,如何調試服務器端腳本?客戶端很容易)使用Mac OS X 10.9不知道這是否是培訓相關米......Meteor.http.get請求 - >錯誤:主機名/ IP不匹配證書的altnames
感謝 羅南
客戶端代碼:
'click #buildButton' : function() {
console.log("Jenkins job request");
$('#buildButton').attr('disabled','true').val('loading...');
var userName = "Ronen";
Meteor.call('jenkinsServiceBuild', function(err, respJson) {
if(err) {
window.alert("Error: " + err.reason);
console.log("error occured on receiving data on server. ", err);
} else {
window.alert("Success: ");
console.log("respJson: ", respJson);
//window.alert(respJson.length + ' tweets received.');
Session.set("recentTweets",respJson);
}
$('#buildButton').removeAttr('disabled').val('build');
});
}
服務器端代碼:
Meteor.methods({jenkinsServiceBuild: function(userName) {
var url = "https://www.ynet.co.il";
//synchronous GET
var result = Meteor.http.get(url, {timeout:30000});
if(result.statusCode==200) {
var respJson = JSON.parse(result.content);
console.log("response received.");
return respJson;
} else {
console.log("Response issue: ", result.statusCode);
var errorJson = JSON.parse(result.content);
throw new Meteor.Error(result.statusCode, errorJson.error);
}
}
});
太棒了,你是對的它服務的JSON內容 – user3087483