Esempio n. 1
0
        public void GetAsync_ConnectionClose()
        {
            var uri = new Uri("http://www.cube-soft.jp/");
            var h   = new Cube.Net.Http.HeaderHandler
            {
                UserAgent       = GetUserAgent(),
                ConnectionClose = true
            };

            using (var http = Cube.Net.Http.HttpClientFactory.Create(h))
                using (var response = http.GetAsync(uri).Result)
                {
                    Assert.That(response.Headers.Connection.Contains("Close"));
                }
        }
Esempio n. 2
0
        public void GetAsync_EntityTag()
        {
            var uri = new Uri("https://www.cube-soft.jp/favicon.ico");
            var h   = new Cube.Net.Http.HeaderHandler {
                UserAgent = GetUserAgent()
            };

            using (var http = Cube.Net.Http.HttpClientFactory.Create(h))
            {
                using (var r = http.GetAsync(uri).Result) Assert.That(r.StatusCode, Is.EqualTo(HttpStatusCode.OK));
                var tag = h.EntityTag;
                using (var r = http.GetAsync(uri).Result)
                {
                    Assert.That(h.EntityTag, Is.EqualTo(tag));
                    Assert.That(r.StatusCode, Is.EqualTo(HttpStatusCode.NotModified));
                }
            }
        }