/// <summary> /// Configures the function host, adding a catch-all route that then hands off to Menes to process the request. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder"/> to configure.</param> public void Configure(IApplicationBuilder app) { var openApiRouteHandler = new RouteHandler( async context => { try { IOpenApiHost <HttpRequest, IActionResult> handler = context.RequestServices.GetRequiredService <IOpenApiHost <HttpRequest, IActionResult> >(); IActionResult result = await handler.HandleRequestAsync(context.Request.Path, context.Request.Method, context.Request, context).ConfigureAwait(false); var actionContext = new ActionContext(context, context.GetRouteData(), new ActionDescriptor()); await result.ExecuteResultAsync(actionContext).ConfigureAwait(false); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }); var routeBuilder = new RouteBuilder(app, openApiRouteHandler); routeBuilder.MapRoute("CatchAll", "{*path}"); IRouter router = routeBuilder.Build(); app.UseRouter(router); }
public OperationsStatusApiAndTasksSteps(FeatureContext featureContext, ScenarioContext scenarioContext) { this.serviceProvider = ContainerBindings.GetServiceProvider(featureContext); this.repository = this.serviceProvider.GetRequiredService <FakeOperationsRepository>(); this.host = this.serviceProvider.GetRequiredService <IOpenApiHost <HttpRequest, IActionResult> >(); this.scenarioContext = scenarioContext; this.transientTenantManager = TransientTenantManager.GetInstance(featureContext); }
/// <summary> /// Initializes a new instance of the <see cref="ClaimsHost"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public ClaimsHost(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }
/// <summary> /// Initializes a new instance of the <see cref="Host"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public HostFunction(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }
/// <summary> /// Initializes a new instance of the <see cref="ContentManagementHost"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public ContentManagementHost(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }
/// <summary> /// Uses the <see cref="IOpenApiHost{HttpRequest, IActionResult}"/> to handle the request. /// </summary> /// <param name="host">The host to handle the request.</param> /// <param name="httpRequest">The request to handle.</param> /// <param name="parameters">Any dynamically constructed parameters sent to the request.</param> /// <returns>The result of the request.</returns> public static Task <IActionResult> HandleRequestAsync(this IOpenApiHost <HttpRequest, IActionResult> host, HttpRequest httpRequest, object parameters) { return(host.HandleRequestAsync(httpRequest.Path, httpRequest.Method, httpRequest, parameters)); }
/// <summary> /// Initializes a new instance of the <see cref="TenancyHost"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public TenancyHost(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }
/// <summary> /// Initializes a new instance of the <see cref="HttpStarter"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public HttpStarter(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }
/// <summary> /// Initializes a new instance of the <see cref="OperationsStatusHost"/> class. /// </summary> /// <param name="host">The OpenApi host.</param> public OperationsStatusHost(IOpenApiHost <HttpRequest, IActionResult> host) { this.host = host; }