code: function httpRequestPromise(method, urlObject) {
    if (method !== 'GET' && method !== 'HEAD') {
      return Promise.reject(new Error('We only support GET or HEAD requests'));
    }
  
    return new Promise(function (resolve, reject) {
      var httpsRequestOptions = {
        host: urlObject.host,
        method: method,
        path: urlObject.path
      };
  
      var req = https.request(httpsRequestOptions, function (res) {
        if (res.statusCode !== 200) {
          reject(new Error('Did not get 200 for ' + urlObject.href +
            ', instead got ' + res.statusCode));
          return;
        }
  
        resolve(res);
      })
      .on('error', function (e) {
        reject(new Error('Got error on ' + urlObject.href + ' - ' + e));
      });
  
      req.end();
    });
  }
docs: Unfortunately the obvious library, request-promise, doesn't handle streams well so it would take the multi-megabyte ZIP response file and turn it into an in-memory string. So we use this instead.