示例#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));
        }
示例#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)));
 }