function createResponse(status, data, headers, statusText) {
    if (angular.isFunction(status)) return status;

    return function() {
      return angular.isNumber(status)
          ? [status, data, headers, statusText, 'complete']
          : [200, status, data, headers, 'complete'];
    };
  }
General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
  - passing through is disabled
  - auto flushing is disabled

Returns instance for e2e testing (when `$delegate` and `$browser` specified):
  - passing through (delegating request to real backend) is enabled
  - auto flushing is enabled

@param {Object=} $delegate Real $httpBackend instance (allow passing through if specified)
@param {Object=} $browser Auto-flushing enabled if specified
@return {Object} Instance of $httpBackend mock