Ejemplo n.º 1
0
        public static HttpResponseBuilder WhenGet(this HttpHandlerBuilder builder, string path = null)
        {
            bool Match(HttpContext context)
            {
                if (path != null && !context.MatchPath(path))
                {
                    return(false);
                }
                return(context.Request.Method.Equals(HttpMethod.Get.ToString()));
            }

            return(builder.When(Match));
        }
Ejemplo n.º 2
0
 public static HttpResponseBuilder WhenPost(this HttpHandlerBuilder builder, string path, Func <HttpContext, bool> matcher)
 {
     return(builder.When(context => context.Request.Method.Equals(HttpMethod.Post.ToString()) && context.MatchPath(path) && matcher(context)));
 }