예제 #1
0
        public HealthCheckModule(IEnumerable <IChecker> checkers, HealthCheckOptions options = null)
        {
            if (options == null)
            {
                options = new HealthCheckOptions();
            }
            if (options.RequireHttps)
            {
                this.RequiresHttps(redirect: false);
            }

            Get[options.Route, true] = async(_, ct) =>
            {
                if (options.AuthorizationCallback != null && !await options.AuthorizationCallback(Context))
                {
                    return(HttpStatusCode.Unauthorized);
                }
                return(Response.AsJson(await(new Core.HealthCheck(checkers).Run())));
            };
        }
        public HealthCheckModule(IEnumerable<IChecker> checkers, HealthCheckOptions options = null)
        {
            if (options == null)
            {
                options = new HealthCheckOptions();
            }
            if (options.RequireHttps)
            {
                this.RequiresHttps(redirect: false);
            }

            Get[options.Route, true] = async (_, ct) =>
            {
                if (options.AuthorizationCallback != null && !await options.AuthorizationCallback(Context))
                {
                    return HttpStatusCode.Unauthorized;
                }
                return Response.AsJson(await (new Core.HealthCheck(checkers).Run()));
            };
        }