code: function $httpBackend(method, url, data, callback, headers) {
      var xhr = new MockXhr(),
          expectation = expectations[0],
          wasExpected = false;
  
      function prettyPrint(data) {
        return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp)
            ? data
            : angular.toJson(data);
      }
  
      if (expectation && expectation.match(method, url)) {
        if (!expectation.matchData(data))
          throw Error('Expected ' + expectation + ' with different data\n' +
              'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT:      ' + data);
  
        if (!expectation.matchHeaders(headers))
          throw Error('Expected ' + expectation + ' with different headers\n' +
              'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT:      ' +
              prettyPrint(headers));
  
        expectations.shift();
  
        if (expectation.response) {
          responses.push(function() {
            var response = expectation.response(method, url, data, headers);
            xhr.$$respHeaders = response[2];
            callback(response[0], response[1], xhr.getAllResponseHeaders());
          });
          return;
        }
        wasExpected = true;
      }
  
      var i = -1, definition;
      while ((definition = definitions[++i])) {
        if (definition.match(method, url, data, headers || {})) {
          if (definition.response) {
            // if $browser specified, we do auto flush all requests
            ($browser ? $browser.defer : responsesPush)(function() {
              var response = definition.response(method, url, data, headers);
              xhr.$$respHeaders = response[2];
              callback(response[0], response[1], xhr.getAllResponseHeaders());
            });
          } else if (definition.passThrough) {
            $delegate(method, url, data, callback, headers);
          } else throw Error('No response defined !');
          return;
        }
      }
      throw wasExpected ?
          Error('No response defined !') :
          Error('Unexpected request: ' + method + ' ' + url + '\n' +
                (expectation ? 'Expected ' + expectation : 'No more request expected'));
    }
docs: TODO(vojta): change params to: method, url, data, headers, callback