title: Node.js HTTP request not returning full response
body: <p>I'm making a <em>HTTP</em> request using Node's <code>http</code> module, but on <code>data</code>, the chunk returned doesn't seem to content the full request response. Here's my code:</p>
  
  <pre><code>var req = http.request(httpOptions, function(res) {
      res.setEncoding('utf8');
  });
  
  req.on('response', function (response) {
      response.on('data', function (chunk) {
          console.log(chunk);
          callback(null, JSON.parse(chunk));
      });
  });
  
  req.on('error', function(e) {
      callback(e);
      //callback(e.message);
  });
  
  req.end();
  </code></pre>
  
  <p>Is there a way to wait for the full output before ending the request? Am I doing something wrong? Thanks!</p>