Пример #1
0
        public async Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
            {
                var row = await _db.LoadSingleQueryRow();

                var result = JsonConvert.SerializeObject(row, _jsonSettings);

                httpContext.Response.StatusCode    = StatusCodes.Status200OK;
                httpContext.Response.ContentType   = "application/json";
                httpContext.Response.ContentLength = result.Length;

                await httpContext.Response.WriteAsync(result);

                return;
            }

            await _next(httpContext);
        }