コード例 #1
0
        public void AbsolutePathTest()
        {
            var value = new Uri("http://a.com/x");

            var path   = HttpPath.Create(value.OriginalString);
            var output = path.MakeUri(null);

            Assert.Equal(value, output);

            output = path.MakeUri(new Uri("/a/b", UriKind.Relative));
            Assert.Equal(value, output);

            output = path.MakeUri(new Uri("http://a.com/a/b"));
            Assert.Equal(value, output);
        }
コード例 #2
0
        public void NullHttpPathTest()
        {
            var path   = HttpPath.Create(null);
            Uri input  = null;
            var output = path.MakeUri(input);

            Assert.Null(output);

            input  = new Uri("http://a.com");
            output = path.MakeUri(input);
            Assert.Equal(input, output);

            input  = new Uri("/aa/bb", UriKind.Relative);
            output = path.MakeUri(input);
            Assert.Equal(input, output);
        }
コード例 #3
0
 /// <summary>
 /// http请求方法描述特性
 /// </summary>
 /// <param name="method">请求方法</param>
 /// <param name="path">请求绝对或相对路径</param>
 protected HttpMethodAttribute(HttpMethod method, string?path)
 {
     this.Method     = method;
     this.Path       = HttpPath.Create(path);
     this.OrderIndex = int.MinValue + 1;
 }
コード例 #4
0
 /// <summary>
 /// http接口配置网关的域名
 /// </summary>
 /// <param name="path">路径</param>
 public GatewayAttribute(string path)
 {
     this.Path = HttpPath.Create(path);
 }