Friday 28 April 2017

Unable to create HTTP GET request to heroku app with NodeJS. Is there something bad with my request?

I am trying to get a request from a heroku link using Node, but I don't know what in my code. The code in question is belowvar http = require('http'); var keepAlive = new http.Agent({ keepAlive: true }); var options = { hostname: 'http://ift.tt/1LYDP5Y', port: 443, path: '/', agent: keepAlive } http.get(options, (res) => { res.on('data', (res_data) => { console.log(res_data); }); }); Whether I have the agent in or not, I always get the following error:Error: getaddrinfo ENOTFOUND http://ift.tt/1LYDP5Y http://ift.tt/1LYDP5Y I really don't mean to make this sound like a general 'what's wrong with my code', but everything in the http library documentation matches up with what I am doing. Is there a small detail I looked over?EDIT: Never mind. I fixed it by taking out the http:// from the link

Submitted April 28, 2017 at 10:56PM by TheLegendOfCode

No comments:

Post a Comment