Beispiel #1
0
        private static AppDelegate ProcessRequest(AppDelegate next, Regex regex, string method, Action<RoutedRequest, Response> app)
        {
            return (env, result, fault) =>
            {
                var path = (string)env["owin.RequestPath"];

                if (path.EndsWith("/"))
                    path = path.TrimEnd('/');

                if ((string)env["owin.RequestMethod"] == method && regex.IsMatch(path))
                {
                    var req = new RoutedRequest(env, regex, path);
                    var res = new Response(result);
                    app(req, res);
                }
                else
                {
                    next(env, result, fault);
                }
            };
        }
Beispiel #2
0
        private static AppDelegate ProcessRequest(AppDelegate next, Regex regex, string method, Action <RoutedRequest, Response> app)
        {
            return((env, result, fault) =>
            {
                var path = (string)env["owin.RequestPath"];

                if (path.EndsWith("/"))
                {
                    path = path.TrimEnd('/');
                }

                if ((string)env["owin.RequestMethod"] == method && regex.IsMatch(path))
                {
                    var req = new RoutedRequest(env, regex, path);
                    var res = new Response(result);
                    app(req, res);
                }
                else
                {
                    next(env, result, fault);
                }
            });
        }