node.js:Bu temel Node.js hatası neden çalışmıyor?
Ben https eklersenizvar https = require("https");
var request = https.get("google.com/", function(response) {
console.log(response.statusCode);
});
request.on("error", function(error) {
console.log(error.message);
});
: // google alan adına sonra beklendiği gibi durum kodu 200 olsun. Olduğu gibi, hatanın yakalanacağını ve terminal konsoluna yazdırılmak üzere "ECONNREFUSED" kaynağına benzer bir hata mesajı beklerim. Bunun yerine stacktrace'i terminale yazdırır. Eğer source for https.get()
bakarsak
deneyin baskı sadece * hata *, değil * Error.message * –
Ve neden bağlantı reddedilmeli? d – adeneo
'google.com' yerine' https' protokolünü https: // google.com' gibi kullanın. – Maxali