Example #1
0
        public void Can_resolve_paths_with_multipart_root()
        {
            var results = new List <string> {
                HttpRequestExtensions.GetPathInfo("/api/foo/metadata", "api/foo", "api"),
                HttpRequestExtensions.GetPathInfo("/api/foo/1.0/wildcard/metadata", "api/foo/1.0/wildcard", "api"),
                HttpRequestExtensions.GetPathInfo("/location.api.wildcard35/api/foo/metadata", "api/foo", "api"),
                HttpRequestExtensions.GetPathInfo("/this/is/very/nested/metadata", "this/is/very/nested", "api"),
            };

            Console.WriteLine(results.Dump());

            Assert.That(results.All(x => x == "/metadata"));
        }
Example #2
0
 public string ResolvePath(string mode, string path)
 {
     return(HttpRequestExtensions.
            GetPathInfo(path, mode, path.Split('/').First(x => x != "")));
 }