Beispiel #1
0
        public void TestCache()
        {
            HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Revalidate);
              Session.CachePolicy = policy;

              Request req = new Request(Session, new Uri("http://www.dr.dk/drfront/images//2013/05/21/c=0,17,1024,505;w=300;42676.jpg"));

              using (var resp = req.Accept("image/jpeg").Get<byte[]>())
              {
            resp.SaveToFile("c:\\tmp\\scrap.jpg");
            Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode);
              }

              using (var resp = req.Accept("image/jpeg").Get<byte[]>())
              {
            resp.SaveToFile("c:\\tmp\\scrap.jpg");
            Assert.AreEqual(HttpStatusCode.NotModified, resp.StatusCode);
              }
        }