public StatusCodePagesMiddleware(RequestDelegate next, StatusCodePagesOptions options)
 {
     _next = next;
     _options = options;
     if (_options.HandleAsync == null)
     {
         throw new ArgumentException("Missing options.HandleAsync implementation.");
     }
 }
Exemple #2
0
 public StatusCodePagesMiddleware(RequestDelegate next, StatusCodePagesOptions options)
 {
     _next    = next;
     _options = options;
     if (_options.HandleAsync == null)
     {
         throw new ArgumentException("Missing options.HandleAsync implementation.");
     }
 }
        /// <summary>
        /// Adds a StatusCodePages middleware with the given options that checks for responses with status codes 
        /// between 400 and 599 that do not have a body.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseStatusCodePages(this IApplicationBuilder app, StatusCodePagesOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            return app.UseMiddleware<StatusCodePagesMiddleware>(options);
        }
 /// <summary>
 /// Adds a StatusCodePages middleware with the given options that checks for responses with status codes 
 /// between 400 and 599 that do not have a body.
 /// </summary>
 /// <param name="app"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IApplicationBuilder UseStatusCodePages([NotNull]this IApplicationBuilder app, StatusCodePagesOptions options)
 {
     return app.UseMiddleware<StatusCodePagesMiddleware>(options);
 }
 public StatusCodeContext(HttpContext context, StatusCodePagesOptions options, RequestDelegate next)
 {
     HttpContext = context;
     Options     = options;
     Next        = next;
 }
 public StatusCodeContext(HttpContext context, StatusCodePagesOptions options, RequestDelegate next)
 {
     HttpContext = context;
     Options = options;
     Next = next;
 }