title: Node.js set Headers in HTTP GET request
body: <p>I'm using Node.js 'https' module. And i'm sending a GET request with some headers option but I get the following error:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;HTML&gt;
      &lt;HEAD&gt;
          &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"&gt;
          &lt;TITLE&gt;ERROR: The request could not be satisfied&lt;/TITLE&gt;
      &lt;/HEAD&gt;
      &lt;BODY&gt;
          &lt;H1&gt;ERROR&lt;/H1&gt;
          &lt;H2&gt;The request could not be satisfied.&lt;/H2&gt;
          &lt;HR noshade size="1px"&gt; Bad request.
  
          &lt;BR clear="all"&gt;
          &lt;HR noshade size="1px"&gt;
          &lt;PRE&gt; Generated by cloudfront (CloudFront) Request ID: 7H9MBMS_ullYt-ZSpdMw4WjAU0O1QlVaDNw_8QLwlXZa8olpjmRPDQ== &lt;/PRE&gt;
          &lt;ADDRESS&gt;&lt;/ADDRESS&gt;
      &lt;/BODY&gt; &lt;/HTML&gt;
  </code></pre>
  
  <p>Following is my code </p>
  
  <pre><code> const var https = require('https')
   var optionsget = {
                  headers: {
                      'client': process.env.MOVIEGLU_CLIENT,
                      'x-api-key': process.env.MOVIEGLUE_API_KEY,
                      'api-version': process.env.MOVIEGLU_API_VERSION,
                      'Authorization': process.env.MOVIEGLUE_AUTHORISATION,
                      'geolocation': user.loc[0] + ';' + user.loc[1],
                      'Content-Type':'application/x-www-form-urlencoded'
                  },
                  host: process.env.MOVIEGLU_HOST, 
                  path: path,
                  method: 'GET' 
              };
  
              // do the GET request
              var content = ''
              var reqGet = https.request(optionsget, function (response) {
                  response.on('data', function (data) {
                      // Append data.
                      content += data;
                  });
                  response.on('end', function () {
  
                      console.log('content ', content)
                      callback(null, content)
                  })
              });
              reqGet.end();
              reqGet.on('error', function (e) {
                  callback(e, null)
              });
          });
  </code></pre>
  
  <p>Can someone please guide me what i'm doing wrong in setting headers? I'm really stuck.</p>
  
  <p>Thanks</p>