docs: function sendReq(config, reqData) {
        var deferred = $q.defer(),
            promise = deferred.promise,
            cache,
            cachedResp,
            reqHeaders = config.headers,
            url = buildUrl(config.url, config.params);
  
        $http.pendingRequests.push(config);
        promise.then(removePendingReq, removePendingReq);
  
  
        if ((config.cache || defaults.cache) && config.cache !== false &&
            (config.method === 'GET' || config.method === 'JSONP')) {
          cache = isObject(config.cache) ? config.cache
                : isObject(defaults.cache) ? defaults.cache
                : defaultCache;
        }
  
        if (cache) {
          cachedResp = cache.get(url);
          if (isDefined(cachedResp)) {
            if (isPromiseLike(cachedResp)) {
              // cached request has already been sent, but there is no response yet
              cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
            } else {
              // serving from cache
              if (isArray(cachedResp)) {
                resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
              } else {
                resolvePromise(cachedResp, 200, {}, 'OK');
              }
            }
          } else {
            // put the promise for the non-transformed response into cache as a placeholder
            cache.put(url, promise);
          }
        }
  
  
        // if we won't have the response in cache, set the xsrf headers and
        // send the request to the backend
        if (isUndefined(cachedResp)) {
          var xsrfValue = urlIsSameOrigin(config.url)
              ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]
              : undefined;
          if (xsrfValue) {
            reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
          }
  
          $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
              config.withCredentials, config.responseType);
        }
  
        return promise;
  
  
        /**
         * Callback registered to $httpBackend():
         *  - caches the response if desired
         *  - resolves the raw $http promise
         *  - calls $apply
         */
        function done(status, response, headersString, statusText) {
          if (cache) {
            if (isSuccess(status)) {
              cache.put(url, [status, response, parseHeaders(headersString), statusText]);
            } else {
              // remove promise from the cache
              cache.remove(url);
            }
          }
  
          function resolveHttpPromise() {
            resolvePromise(response, status, headersString, statusText);
          }
  
          if (useApplyAsync) {
            $rootScope.$applyAsync(resolveHttpPromise);
          } else {
            resolveHttpPromise();
            if (!$rootScope.$$phase) $rootScope.$apply();
          }
        }
  
  
        /**
         * Resolves the raw $http promise.
         */
        function resolvePromise(response, status, headers, statusText) {
          // normalize internal statuses to 0
          status = Math.max(status, 0);
  
          (isSuccess(status) ? deferred.resolve : deferred.reject)({
            data: response,
            status: status,
            headers: headersGetter(headers),
            config: config,
            statusText: statusText
          });
        }
  
        function resolvePromiseWithResult(result) {
          resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
        }
  
        function removePendingReq() {
          var idx = $http.pendingRequests.indexOf(config);
          if (idx !== -1) $http.pendingRequests.splice(idx, 1);
        }
      }