code: function prepXHR(method, url, headers, callback, withCredentials, type, manager) {
      var xhr = new XHR();
      var status;
  
      xhr.open(method, url, true);
  
      if (type) {
        xhr.type = type;
        headers['Content-Type'] = type;
      }
  
      angular.forEach(headers, function(value, key) {
        (value) ? xhr.setRequestHeader(key, value) : null;
      });
  
      manager.register(xhr);
  
      xhr.onreadystatechange = function() {
        if (xhr.readyState == 4) {
          manager.unregister(xhr);
          var response = xhr.response || xhr.responseText;
          callback(status = status || xhr.status, response, xhr.getAllResponseHeaders());
        }
      };
  
      if (withCredentials) {
        xhr.withCredentials = true;
      }
      return xhr;
    }
docs: Initializes XHR object with parameters from $httpBackend.