public override void Set(string name, string value)
        {
#if NETFX_CORE
            _actual[name] = value;
#else
            _actual.Set(name, value);
#endif
        }
        public void sameHeadersCombineWithComma()
        {
            var headers     = new System.Net.WebHeaderCollection();
            var cacheValues = new List <string>();

            cacheValues.Add("no-cache");
            cacheValues.Add("no-store");
            headers.Set("Cache-Control", cacheValues.Join(", "));
            var res = new Response();

            res.ProcessResponseHeaders(headers);
            Assert.AreEqual("no-cache, no-store", res.Header("Cache-Control"));
        }
Esempio n. 3
0
        public void ignoresEmptyCookieNameAndVals()
        {
            // prep http response header map
            System.Net.WebHeaderCollection headers = new System.Net.WebHeaderCollection();

            headers.Set("Set-Cookie", "one;two=;three=;four=data; Domain=.example.com; Path=/");

            Response res = new Response();

            res.ProcessResponseHeaders(headers);
            Assert.AreEqual(4, res.Cookies().Count);
            Assert.AreEqual("", res.Cookie("one"));
            Assert.AreEqual("", res.Cookie("two"));
            Assert.AreEqual("", res.Cookie("three"));
            Assert.AreEqual("data", res.Cookie("four"));
        }
        public void ignoresEmptyCookieNameAndVals()
        {
            // prep http response header map
            var headers       = new System.Net.WebHeaderCollection();
            var cookieStrings = new List <string>();

            cookieStrings.Add(null);
            cookieStrings.Add("");
            cookieStrings.Add("one");
            cookieStrings.Add("two=");
            cookieStrings.Add("three=");
            cookieStrings.Add("four=data; Domain=.example.com; Path=/");
            headers.Set("Set-Cookie", cookieStrings.Join(";"));

            var res = new Response();

            res.ProcessResponseHeaders(headers);
            Assert.AreEqual(4, res.Cookies().Count);
            Assert.AreEqual(string.Empty, res.Cookie("one"));
            Assert.AreEqual(string.Empty, res.Cookie("two"));
            Assert.AreEqual(string.Empty, res.Cookie("three"));
            Assert.AreEqual("data", res.Cookie("four"));
        }
Esempio n. 5
0
		public void ignoresEmptyCookieNameAndVals()
		{
			// prep http response header map
			var headers = new System.Net.WebHeaderCollection();
			var cookieStrings = new List<string>();
			cookieStrings.Add(null);
			cookieStrings.Add("");
			cookieStrings.Add("one");
			cookieStrings.Add("two=");
			cookieStrings.Add("three=");
			cookieStrings.Add("four=data; Domain=.example.com; Path=/");
			headers.Set("Set-Cookie", cookieStrings.Join(";"));

			var res = new Response();
			res.ProcessResponseHeaders(headers);
			Assert.AreEqual(4, res.Cookies().Count);
			Assert.AreEqual(string.Empty, res.Cookie("one"));
			Assert.AreEqual(string.Empty, res.Cookie("two"));
			Assert.AreEqual(string.Empty, res.Cookie("three"));
			Assert.AreEqual("data", res.Cookie("four"));
		}
Esempio n. 6
0
		public void sameHeadersCombineWithComma()
		{
			var headers = new System.Net.WebHeaderCollection();
			var cacheValues = new List<string>();
			cacheValues.Add("no-cache");
			cacheValues.Add("no-store");
			headers.Set("Cache-Control", cacheValues.Join(", "));
			var res = new Response();
			res.ProcessResponseHeaders(headers);
			Assert.AreEqual("no-cache, no-store", res.Header("Cache-Control"));
		}
Esempio n. 7
0
        public void ignoresEmptyCookieNameAndVals()
        {
            // prep http response header map
            System.Net.WebHeaderCollection headers = new System.Net.WebHeaderCollection();

            headers.Set("Set-Cookie", "one;two=;three=;four=data; Domain=.example.com; Path=/");

            Response res = new Response();
            res.ProcessResponseHeaders(headers);
            Assert.AreEqual(4, res.Cookies().Count);
            Assert.AreEqual("", res.Cookie("one"));
            Assert.AreEqual("", res.Cookie("two"));
            Assert.AreEqual("", res.Cookie("three"));
            Assert.AreEqual("data", res.Cookie("four"));
        }