title: HTTP GET request, no "data chunks" received
body: <p>Im having a problem with a GET request. The problem is that the data variable is not populated, its empty, but the result code is 200, there are no issues. If I open the link manually in the browser the data is there. Here is my code:</p>
  
  <pre><code>class DataHandler {
      constructor(httpRobot, config) {
          DataHandler.prototype.httpRobot = httpRobot;
          DataHandler.prototype.config = config;       
      }
  }
  
  class GetData extends DataHandler {
      constructor(httpRobot, config) {
          super(httpRobot, config);
      }
      R(RURL) {
          var data = '';
  
          super.httpRobot.get(RURL, (resp) =&gt; {
              console.log(resp.statusCode)
              resp.on('data', (chunk) =&gt; (
                  data += chunk
              ))
  
              resp.on('end', () =&gt; {
                  data = JSON.parse(data);
              })
  
          });
          console.log(data);
          return data;
      }
  }
  </code></pre>
  
  <p>And then call it with:</p>
  
  <pre><code>var httpRobot = require('http')
  const GetData = require('./scripts/DataHandling/GetData')(httpRobot, config)
  GetData.R('theurl')
  </code></pre>
  
  <p>When I call the R method, I give it the URL and it should return the data, but it doesnt. I have checked and the super.httpRobot does contain the http object. The request is executing, the response code is 200, but data stays empty. Its a JSON object that I am expecting to receive, and I have used this code in the past with success, but I cant figure out why its not working now.</p>