title: Node.js request directly to URL with options (http or https)
body: <p>I think I'm missing something about http and https requests</p>
  
  <p>I have a variable that contains a URL, for example:</p>
  
  <p><code>http(s)://website.com/a/b/file.html</code></p>
  
  <p>I would like to know if there's a easy way to make a request to that URI to get the data</p>
  
  <p>To make a http(s)Request, here's what I have to do now:</p>
  
  <ol>
  <li>Test if the URL is http or https to make the appropriate request</li>
  <li>Remove the http(s):// part and put the result in a variable (If I specify http or https in the hostname, I get an error)</li>
  <li>Separate the hostname from the path: <code>website.com</code> and `/a/b/file.html</li>
  <li>Put this variables in the options objects</li>
  </ol>
  
  <p>Is this a must or are they easier solutions that don't involve getting out the hostname and path, and testing if the site is in http or https ?</p>
  
  <p>Edit: I can't use http.get as I need to put some specific options</p>