Promise to perform a get request and return the result

@param {string} url The url to request
@return {Promise.<string>} The body of the response
function httpGetPromise(url) {
  var deferred = Q.defer(), get;

  var cb = function (res) {
    var data = '';

    res.on('data', function (chunk) {
      data += chunk;
    });

    res.on('err', function (err) {
      debug(err + ' ' + url);
      deferred.reject(err);
    });

    res.on('end', function () {
      if (res.statusCode !== 200) {
        debug(res.statusCode + ': ' + url);
        deferred.resolve();
      } else {
        debug('fetched ' + url);
        deferred.resolve(data);
      }
    });
  };

  if (url.match(/^https/)) {
    get = https.get(url, cb);
  } else {
    get = http.get(url, cb);
  }

  get.on('error', function (err) {
    deferred.resolve();
    debug(err + ': ' + url);
  });

  return deferred.promise;
}