public async Task HandleRequest()
        {
            var options    = httpContext.RequestServices.GetRequiredService <EndpointOptions>();
            var parameters = await parameterFactory(httpContext, options);

            var endpointHandler = httpContext.RequestServices.GetRequiredService(executor.EndpointType);
            var result          = (IEndpointResult)await executor.Execute(endpointHandler, parameters);

            await result.ExecuteResultAsync(httpContext, options);
        }
Пример #2
0
        public async Task HandleRequest()
        {
            var options    = httpContext.RequestServices.GetRequiredService <EndpointOptions>();
            var parameters = await parameterFactory(httpContext, options);

            var endpointHandler = httpContext.RequestServices.GetRequiredService(executor.EndpointType);
            var result          = await executor.Execute(endpointHandler, parameters);

            httpContext.Response.StatusCode = 200;
            await options.JsonSerializer.SerializeToResponse(httpContext.Response, result, executor.ObjectReturnType, httpContext.RequestAborted);
        }
Пример #3
0
        public async Task HandleRequest()
        {
            var options    = httpContext.RequestServices.GetRequiredService <EndpointOptions>();
            var parameters = await parameterFactory(httpContext, options);

            var endpointHandler = httpContext.RequestServices.GetRequiredService(executor.EndpointType);
            var result          = (string)await executor.Execute(endpointHandler, parameters);

            httpContext.Response.StatusCode  = 200;
            httpContext.Response.ContentType = "text/plain; charset = utf-8";
            await httpContext.Response.WriteAsync(result, System.Text.Encoding.UTF8, httpContext.RequestAborted);
        }