예제 #1
0
파일: Middleware.cs 프로젝트: tstone/Fusion
 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
파일: Middleware.cs 프로젝트: tstone/Fusion
        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;
 }