title: HTTPS request in NodeJS
body: <p>I am trying to write a NodeJS app which will talk to the OpenShift REST API using the request method in the https package. Here is the code:</p>
  
  <pre><code>var https = require('https');
  
  var options = {
    host: 'openshift.redhat.com',
    port: 443,
    path: '/broker/rest/api',
    method: 'GET'
  };
  
  var req = https.request(options, function(res) {
    console.log(res.statusCode);
    res.on('data', function(d) {
      process.stdout.write(d);
    });
  });
  req.end();
  
  req.on('error', function(e) {
    console.error(e);
  });
  </code></pre>
  
  <p>But this is giving me an error (status code 500 is returned). When I did the same thing using curl on the command line,</p>
  
  <pre><code>curl -k -X GET https://openshift.redhat.com/broker/rest/api
  </code></pre>
  
  <p>I am getting the correct response from the server.</p>
  
  <p>Is there anything wrong in the code?</p>