Example #1
0
        /// <summary>
        /// Integrate status url handling
        /// </summary>
        public static void UseStatusApi(this IApplicationBuilder app, string path = "/status", JsonSerializerSettings serializerSettings = null)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var detector   = new StatusRequestDetector(path);
            var urlHandler = new StatusProviderUrlHandler(detector, serializerSettings);

            app.MapWhen(ctx =>
                        detector.DetectAndGetRelatedPath(ctx.Request) != null,
                        appB =>
            {
                appB.Run(async context => await urlHandler.Handle(app, context));
            });
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="StatusProviderUrlHandler"/>
 /// </summary>
 public StatusProviderUrlHandler(StatusRequestDetector detector, JsonSerializerSettings serializerSettings)
 {
     _detector           = detector;
     _serializerSettings = serializerSettings ?? DefaultJsonSerializationSettings.Create();
 }