title: nodejs - use res.send - after http request finished
body: <p>Im using node with express and I am calling within my node server a http get request - now when the complete data arrived from the http-request I want to call <code>res.send</code> with the received data. 
  My code looks as follows: </p>
  
  <pre><code>app.get('/', function (req, res) {
  
  const x = https.get(options, (req) =&gt; {
      console.log('statusCode:', req.statusCode);
      console.log('headers:', req.headers);
  
      req.on('data', (locations) =&gt; {
          buffer = new Buffer(locations);
          console.log(buffer);
          res.send(buffer);      &lt;== should sent complete result
      });
  
  }).on('error', (err) =&gt; console.log('error:', err));
  
  x.end();
  });
  
  app.listen(port, function () {
      console.log('Example app listening on port 3000!');
  });
  </code></pre>
  
  <p>The Problem With my Code:
  I get everytime a different size of data - basically - everytime a incomplete set of data.</p>