本文整理汇总了C#中Response.ProcessResponseHeaders方法的典型用法代码示例。如果您正苦于以下问题:C# Response.ProcessResponseHeaders方法的具体用法?C# Response.ProcessResponseHeaders怎么用?C# Response.ProcessResponseHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response.ProcessResponseHeaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ignoresEmptyCookieNameAndVals
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"));
}
示例2: sameHeadersCombineWithComma
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"));
}
示例3: ignoresEmptySetCookies
public void ignoresEmptySetCookies()
{
// prep http response header map
var headers = new System.Net.WebHeaderCollection();
headers["Set-Cookie"] = string.Empty;
Response res = new Response();
res.ProcessResponseHeaders(headers);
Assert.AreEqual(0, res.Cookies().Count);
}
示例4: ignoresEmptyCookieNameAndVals
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"));
}