Reputation: 173
Error: getaddrinfo ENOTFOUND jsonplaceholder.typicode.com/ jsonplaceholder.typicode.com/:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
My code look like this -
var test = await new Promise((resolve, reject) => {
var options = {
host: 'jsonplaceholder.typicode.com/',
path: '/posts/1'
};
var req = http.request(options);
req.end();
req.on('connect', (res, socket, head) => {
socket.on('data', (chunk) => {
resolve(chunk.toString());
});
socket.on('end', () => {
proxy.close();
});
});
});
It seems there is a issue with port number but i can not figure out, Please help me to identify the issue.
Upvotes: 0
Views: 399
Reputation: 956
Remove the trailing slash from the host property of your options
Upvotes: 1