Пример #1
0
 public static MiddlewareState DebugInbound(Request req, Response res)
 {
     if (req is Http.HttpRequest)
     {
         Http.HttpRequest hreq = (Http.HttpRequest)req;
         Console.WriteLine(" ** Request: " + hreq.Verb + " " + hreq.Path);
     }
     else
         Console.WriteLine(" ** Inbound: " + req.Body + "<END>");
     return new MiddlewareState(req, res);
 }
Пример #2
0
        internal void OnRequestHandler(Request req, Response res)
        {
            MiddlewareState state = new MiddlewareState(req, res);

            if (this.RequestModules != null)
            {
                // Invoke each request middleware
                foreach (RequestMiddleware rm in this.RequestModules)
                    state = rm(state.Request, state.Response);
            }

            // Call the original handler with the modified state
            this.Handler(state.Request, state.Response);
        }
Пример #3
0
 public MiddlewareState(Request req, Response res)
 {
     this.Request = req;
     this.Response = res;
 }