public void TryResolve_SimpleMatch_Success() { // Arrange var httpContext = new DefaultHttpContext(); httpContext.Request.Path = "/api/test/"; // Act resolver.TryResolve(httpContext, out var route).Should().BeTrue(); // Assert route.Should().NotBeNull(); route !.PathSuffix.Should().Be("test/"); }
private async Task <bool> ProxyAsync(HttpContext httpContext) { if (!routeResolver.TryResolve(httpContext, out var route)) { return(false); } logger.LogDebug( "Reverse proxy found a matching route for the inbound downstream HTTP '{0}' request.", httpContext.Request.Method); var context = new ProxyContext( evaluator, httpContext, route); var cancellationToken = httpContext.RequestAborted; var upstreamRequest = await CreateUpstreamRequestAsync(context, cancellationToken); var upstreamResponse = await SendUpstreamRequestAsync(context, upstreamRequest, cancellationToken); await SendDownstreamResponseAsync(context, upstreamResponse, cancellationToken); return(true); }