Exemple #1
0
            // Awaited fallbacks for when the Tasks do not synchronously complete
            static async Task AwaitMatcher(EndpointRoutingMiddleware middleware, HttpContext httpContext, EndpointSelectorContext feature, Task <Matcher> matcherTask)
            {
                var matcher = await matcherTask;
                await matcher.MatchAsync(httpContext, feature);

                await middleware.SetRoutingAndContinue(httpContext, feature);
            }
Exemple #2
0
        private EndpointRoutingMiddleware CreateMiddleware(Logger <EndpointRoutingMiddleware> logger = null)
        {
            RequestDelegate next = (c) => Task.FromResult <object>(null);

            logger = logger ?? new Logger <EndpointRoutingMiddleware>(NullLoggerFactory.Instance);

            var options        = Options.Create(new EndpointOptions());
            var matcherFactory = new TestMatcherFactory(true);
            var middleware     = new EndpointRoutingMiddleware(
                matcherFactory,
                new CompositeEndpointDataSource(Array.Empty <EndpointDataSource>()),
                logger,
                next);

            return(middleware);
        }
Exemple #3
0
        private EndpointRoutingMiddleware CreateMiddleware(
            Logger <EndpointRoutingMiddleware> logger = null,
            MatcherFactory matcherFactory             = null,
            RequestDelegate next = null)
        {
            next ??= c => Task.CompletedTask;
            logger ??= new Logger <EndpointRoutingMiddleware>(NullLoggerFactory.Instance);
            matcherFactory ??= new TestMatcherFactory(true);

            var middleware = new EndpointRoutingMiddleware(
                matcherFactory,
                logger,
                new DefaultEndpointRouteBuilder(Mock.Of <IApplicationBuilder>()),
                next);

            return(middleware);
        }
Exemple #4
0
        private EndpointRoutingMiddleware CreateMiddleware(
            Logger <EndpointRoutingMiddleware> logger = null,
            MatcherFactory matcherFactory             = null)
        {
            RequestDelegate next = (c) => Task.FromResult <object>(null);

            logger         = logger ?? new Logger <EndpointRoutingMiddleware>(NullLoggerFactory.Instance);
            matcherFactory = matcherFactory ?? new TestMatcherFactory(true);

            var middleware = new EndpointRoutingMiddleware(
                matcherFactory,
                logger,
                new DefaultEndpointRouteBuilder(Mock.Of <IApplicationBuilder>()),
                next);

            return(middleware);
        }
Exemple #5
0
 static async Task AwaitMatch(EndpointRoutingMiddleware middleware, HttpContext httpContext, EndpointSelectorContext feature, Task matchTask)
 {
     await matchTask;
     await middleware.SetRoutingAndContinue(httpContext, feature);
 }
 static async Task AwaitMatch(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
 {
     await matchTask;
     await middleware.SetRoutingAndContinue(httpContext);
 }