'use strict';

const https = require('https');

function _request(options, body) {
  return new Promise(function(resolve, reject) {
    const request = https.request(Object.assign({
      hostname: 'api.mojang.com',
      headers: { 'Content-Type': 'application/json' },
    }, options), function(resp) {
      let data = [];

      resp.on('data', function(chunk) {
        data.push(chunk);
      });

      resp.on('end', function() {
        data = JSON.parse(Buffer.concat(data).toString());
        resolve(data);
      });

      resp.on('error', reject);
    });
    request.on('error', reject);

    if (typeof body === 'object' && !(body instanceof Buffer)) {
      request.write(JSON.stringify(body));
    } else if (typeof body !== 'undefined') {
      request.write(body);
    }
    request.end();
  });
}

module.exports = _request;

@@ -427,24 +427,120 @@
 unction() %7B%0A
+        if(data.length %3C 1)%7B%0A          return reject(new Error(%22No data received.%22));%0A        %7D%0A
         data

Patch when no data received.