Пример #1
0
        public static void UseDebugMiddleware(this IAppBuilder app, DebugMiddlewareOptions options = null)
        {
            if (options == null)
            {
                options = new DebugMiddlewareOptions();
            }

            app.Use <DebugMiddleware>(options);
        }
        public DebugMiddleware(AppFunc next, DebugMiddlewareOptions options)
        {
            _next    = next;
            _options = options;

            if (_options.OnIncomingRequest == null)
            {
                _options.OnIncomingRequest = (ctx) => { Debug.WriteLine("Incoming Request: " + ctx.Request.Path); };
            }

            if (_options.OnOutgoingRequest == null)
            {
                _options.OnOutgoingRequest = (ctx) => { Debug.WriteLine("Outgoing Request: " + ctx.Request.Path); };
            }
        }