[英]getaddrinfo ENOTFOUND when making a post request using node.js
我想使用Node.js向我的服務器發送POST請求
function login(email, company_code, password){
var options = {
hostname: '266fd57b.ngrok.io',
path: '/v1/manager/sign_in',
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: {
'email': email,
'company_code': company_code,
'password': password
}
};
var req = https.request(options, function(res) {
console.log('Status: ' + res.statusCode);
console.log('Headers: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (body) {
console.log('Body: ' + body);
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// write data to request body
req.write('{"string": "Hello, World"}');
req.end();
return true;
}
但我不斷出錯:
getaddrinfo ENOTFOUND 266fd57b.ngrok.io 266fd57b.ngrok.io:443
我嘗試了在Internet上找到的所有修復程序,但沒有任何效果。
噢,天哪,這是因為我尚未輸入Google的帳單帳戶。 Dialogflow需要一個信用卡號才能正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.