예제 #1
0
        public async Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.HasValue)
            {
                var endpoint = httpContext.Request.Path.Value;
                if (_endpoints.Contains(endpoint))
                {
                    Lazy <EndpointHandler> handler;
                    if (_endpointHandlers.TryGetValue(endpoint, out handler))
                    {
                        var response = await handler.Value.Handle(httpContext);

                        MiddlewareHelpers.WriteTo(httpContext.Response, response);
                        return;
                    }
                }
            }

            await _next(httpContext);
        }
        public async Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.HasValue)
            {
                var endpoint = httpContext.Request.Path.Value;
                if (endpoint == OmnisharpEndpoints.CheckAliveStatus)
                {
                    MiddlewareHelpers.WriteTo(httpContext.Response, true);
                    return;
                }

                if (endpoint == OmnisharpEndpoints.CheckReadyStatus)
                {
                    MiddlewareHelpers.WriteTo(httpContext.Response, _workspace.Initialized);
                    return;
                }
            }

            await _next(httpContext);
        }