Пример #1
0
        public void VariableQueryTwoValues()
        {
            var variable = new VariableHttpPathPart("variable");
            var url      = new HttpUrlDescriptor(new KeyValuePair <string, HttpUrlPart>("key", variable)).CreateUrl("http://localhost");

            url.Query["variable"] = new[] { "value1", "value2" };
            Assert.AreEqual("http://localhost?key=value1&key=value2", url.ToString());
        }
Пример #2
0
        public void Mix()
        {
            var variable = new VariableHttpPathPart("key");
            var url      = new HttpUrlDescriptor("path/", variable, "/api").CreateUrl("http://localhost");

            url.Path["key"] = "to";
            Assert.AreEqual("http://localhost/path/to/api", url.ToString());
        }
Пример #3
0
        public void Variable()
        {
            var variable = new VariableHttpPathPart("key");
            var url      = new HttpUrlDescriptor(variable).CreateUrl("http://localhost");

            url.Path["key"] = "foo";
            Assert.AreEqual("http://localhost/foo", url.ToString());
        }
Пример #4
0
        public void FullUrl()
        {
            var variable1 = new VariableHttpPathPart("key1");
            var variable2 = new VariableHttpPathPart("variable2");
            var url       = new HttpUrlDescriptor(new[] { variable1 }, new[] { new KeyValuePair <string, HttpUrlPart>("key2", variable2) }).CreateUrl("http://localhost");

            url.Path["key1"]       = "value1";
            url.Query["variable2"] = new[] { "value2" };
            Assert.AreEqual("http://localhost/value1?key2=value2", url.ToString());
        }
Пример #5
0
 public HttpApiEndpoint(
     MethodInfo method,
     HttpUrlDescriptor url,
     HttpMethod httpMethod,
     Dictionary <string, IHttpArgumentHandler> argumentHandlers,
     IHttpResponseHandler responseHandler,
     IEnumerable <HttpHeader> headers, bool isAsync = true)
 {
     Method           = method;
     Url              = url;
     HttpMethod       = httpMethod;
     ArgumentHandlers = argumentHandlers;
     ResponseHandler  = responseHandler;
     Headers          = headers.ToList();
 }
Пример #6
0
        public void LiteralQuery()
        {
            var url = new HttpUrlDescriptor(new KeyValuePair <string, HttpUrlPart>("key", "value")).CreateUrl("http://localhost");

            Assert.AreEqual("http://localhost?key=value", url.ToString());
        }
Пример #7
0
        public void Literal()
        {
            var path = new HttpUrlDescriptor("foo").CreateUrl("http://localhost");

            Assert.AreEqual("http://localhost/foo", path.ToString());
        }