function xhrRequest(url, responseType) {
  return new Promise(function(resolve, reject) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.responseType = responseType || "json";

    xhr.addEventListener("error", function() {
      reject(Error("Network Error"));
    });

    xhr.addEventListener("load", function() {
      if (xhr.status != 200)
        reject(Error(xhr.statusText));
      else
        resolve(xhr.response);
    });

    xhr.send();
  });
}
Initiates a new XHR via GET.
@param {string} url The endpoint URL for the XHR.
@param {string} responseType Optional - how should the response be parsed.
    Default is "json".
    See: https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetype
@return {Promise} A promise wrapping the success and error events.