Decode chunked Transfer-Encoding from HTTP.call

Hello,

my app needs to do a HTTP(1.1)-request to a second server from the app’s server side. The second server answers with transfer-encoding: chunked (and I cannot influence the second servers behavior, it is even answering with chunked transfer-encoding on HTTP 1.0 requests).

HTTP.call('GET', 'http://URL-of-second-server', {}, (error, result) => {
  if (!error) {
    console.log(result.content);
  }
});

The response body/ content is not automaticly decoded as it would happen with a response to a browser, so it still includes the chunk sizes. Is there a existing solution for that, or do I need to implement the decoding in the app “by hand”?

Meteor’s HTTP package is just a wrapper around request, so it may be worth checking the docs there.