예제 #1
0
        public HttpRoutInfo(string contractTag, string path, MethodInfo method)
        {
            ContractTag = contractTag;
            Path        = path;

            string?pathQuery;
            var    idx = path.IndexOf('?');

            if (idx != -1)
            {
                PathWithoutQuery = path.Substring(0, idx);
                pathQuery        = path.Substring(idx);
            }
            else
            {
                PathWithoutQuery = path;
                pathQuery        = null;
            }

            QueryParams = GetQueryParams(pathQuery);

            _regPatternPathWithoutQuery = ReplacePathStr(PathWithoutQuery);

            var ps = new List <string>();
            var c  = Regex.Matches(path, @"(?<={)[^/]+(?=})");

            foreach (Match?o in c)
            {
                ps.Add(o !.Value.ToLower());
            }

            PathParams = new ReadOnlyCollection <string>(ps);

            MergeArgType = MergeArgTypeFactory.Create(method, GetPathQueryParams(ps, QueryParams));
        }
예제 #2
0
 public HttpRoutInfo(HttpRoutInfo hri)
 {
     _regPatternPathWithoutQuery = hri._regPatternPathWithoutQuery;
     PathParams       = hri.PathParams;
     HttpMethods      = hri.HttpMethods;
     ContractTag      = hri.ContractTag;
     Path             = hri.Path;
     QueryParams      = hri.QueryParams;
     PathWithoutQuery = hri.PathWithoutQuery;
     MergeArgType     = hri.MergeArgType;
 }