39 instantiations of CookieHeaderValue
Microsoft.AspNetCore.Authentication.Test (5)
TwitterTests.cs (3)
216var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value); 266var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value); 373var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value);
WsFederation\WsFederationTest.cs (1)
269request.Headers.Add(HeaderNames.Cookie, new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
WsFederation\WsFederationTest_Handler.cs (1)
267request.Headers.Add(HeaderNames.Cookie, new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
Microsoft.AspNetCore.Http (1)
Features\RequestCookiesFeature.cs (1)
86headers.Add(new CookieHeaderValue(pair.Key, pair.Value).ToString());
Microsoft.AspNetCore.Localization.Tests (5)
CookieRequestCultureProviderTest.cs (4)
66client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue("Preferences", value).ToString()); 116client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue("Preferences", "uic=ar-SA").ToString()); 215client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue("Preferences", $"c={culture}|uic={uiCulture}").ToString()); 275client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue("Preferences", $"c={culture}|uic={uiCulture}").ToString());
RequestLocalizationMiddlewareTest.cs (1)
67client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue("Preferences", $"c={requestedCulture}|uic={requestedCulture}").ToString());
Microsoft.AspNetCore.Mvc.FunctionalTests (5)
TempDataInCookiesUsingCookieConsentTest.cs (1)
116request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
TempDataPropertyTest.cs (1)
169request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
TempDataTestBase.cs (1)
272request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
ViewEngineTests.cs (2)
165new CookieHeaderValue(CookieRequestCultureProvider.DefaultCookieName, cultureCookie).ToString()); 309new CookieHeaderValue(CookieRequestCultureProvider.DefaultCookieName, cultureCookie).ToString());
Microsoft.AspNetCore.Session.Tests (5)
SessionTests.cs (5)
204client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); 264client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); 322client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); 426client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString()); 496"Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
Microsoft.Net.Http.Headers (1)
CookieHeaderParser.cs (1)
30cookieValue = new CookieHeaderValue(parsedName.Value, parsedValue.Value);
Microsoft.Net.Http.Headers.Tests (17)
CookieHeaderValueTest.cs (17)
13var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 16var header2 = new CookieHeaderValue("name2", ""); 19var header3 = new CookieHeaderValue("name3", "value3"); 22var header4 = new CookieHeaderValue("name4", "\"value4\""); 83var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 86var header2 = new CookieHeaderValue("name2", "value2"); 89var header3 = new CookieHeaderValue("name3", "value3"); 92var header4 = new CookieHeaderValue("name4", "\"value4\""); 115var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 118var header2 = new CookieHeaderValue("name2", "value2"); 121var header3 = new CookieHeaderValue("name3", "value3"); 154Assert.Throws<ArgumentNullException>(() => new CookieHeaderValue(null, "value")); 161Assert.Throws<ArgumentException>(() => new CookieHeaderValue(name, "value")); 168Assert.Throws<ArgumentException>(() => new CookieHeaderValue("name", value)); 174var header = new CookieHeaderValue("cookie"); 185var header = new CookieHeaderValue(name, value); 193var cookie = new CookieHeaderValue("name");
85 references to CookieHeaderValue
Microsoft.AspNetCore.Authentication.Test (3)
TwitterTests.cs (3)
216var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value); 266var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value); 373var cookie = new CookieHeaderValue(setCookieValue.Name, setCookieValue.Value);
Microsoft.AspNetCore.HeaderParsing (5)
CommonHeaders.cs (1)
55public static HeaderSetup<IReadOnlyList<CookieHeaderValue>> Cookie => new(HeaderNames.Cookie, CookieHeaderValueListParser.Instance);
Parsers\CookieHeaderValueListParser.cs (4)
11internal sealed class CookieHeaderValueListParser : HeaderParser<IReadOnlyList<CookieHeaderValue>> 15public override bool TryParse(StringValues values, [NotNullWhen(true)] out IReadOnlyList<CookieHeaderValue>? result, [NotNullWhen(false)] out string? error) 17if (!CookieHeaderValue.TryParseList(values, out var parsedValue)) 25result = (IReadOnlyList<CookieHeaderValue>)parsedValue;
Microsoft.AspNetCore.Http.Extensions (6)
HeaderDictionaryTypeExtensions.cs (4)
159private static IList<CookieHeaderValue> ParseCookieHeaderValue(IList<string> value) => 160CookieHeaderValue.TryParseList(value, out var result) ? result : Array.Empty<CookieHeaderValue>(); 245else if (typeof(T) == typeof(CookieHeaderValue))
RequestHeaders.cs (2)
169public IList<CookieHeaderValue> Cookie 173return Headers.Cookie.GetList<CookieHeaderValue>();
Microsoft.AspNetCore.Http.Extensions.Tests (2)
HeaderDictionaryTypeExtensionsTest.cs (2)
219var result = context.Request.GetTypedHeaders().GetList<CookieHeaderValue>(HeaderNames.Cookie); 221List<CookieHeaderValue> expected = [new("cookie1", "a"), new("cookie2", "b")];
Microsoft.Net.Http.Headers (22)
CookieHeaderParser.cs (2)
8internal sealed class CookieHeaderParser : HttpHeaderParser<CookieHeaderValue> 15public override bool TryParseValue(StringSegment value, ref int index, out CookieHeaderValue? cookieValue)
CookieHeaderValue.cs (18)
28/// Initializes a new instance of <see cref="CookieHeaderValue"/>. 41/// Initializes a new instance of <see cref="CookieHeaderValue"/>. 101/// Parses <paramref name="input"/> as a <see cref="CookieHeaderValue"/> value. 105public static CookieHeaderValue Parse(StringSegment input) 112/// Attempts to parse the specified <paramref name="input"/> as a <see cref="CookieHeaderValue"/>. 116/// <returns><see langword="true"/> if input is a valid <see cref="CookieHeaderValue"/>, otherwise <see langword="false"/>.</returns> 117public static bool TryParse(StringSegment input, [NotNullWhen(true)] out CookieHeaderValue? parsedValue) 124/// Parses a sequence of inputs as a sequence of <see cref="CookieHeaderValue"/> values. 128public static IList<CookieHeaderValue> ParseList(IList<string>? inputs) 134/// Parses a sequence of inputs as a sequence of <see cref="CookieHeaderValue"/> values using string parsing rules. 138public static IList<CookieHeaderValue> ParseStrictList(IList<string>? inputs) 144/// Attempts to parse the sequence of values as a sequence of <see cref="CookieHeaderValue"/>. 148/// <returns><see langword="true"/> if all inputs are valid <see cref="CookieHeaderValue"/>, otherwise <see langword="false"/>.</returns> 149public static bool TryParseList(IList<string>? inputs, [NotNullWhen(true)] out IList<CookieHeaderValue>? parsedValues) 155/// Attempts to parse the sequence of values as a sequence of <see cref="CookieHeaderValue"/> using string parsing rules. 160public static bool TryParseStrictList(IList<string>? inputs, [NotNullWhen(true)] out IList<CookieHeaderValue>? parsedValues) 196var other = obj as CookieHeaderValue;
SetCookieHeaderValue.cs (2)
90CookieHeaderValue.CheckNameFormat(value, nameof(value)); 103CookieHeaderValue.CheckValueFormat(value, nameof(value));
Microsoft.Net.Http.Headers.Tests (47)
CookieHeaderValueTest.cs (47)
8public static TheoryData<CookieHeaderValue, string> CookieHeaderDataSet 12var dataset = new TheoryData<CookieHeaderValue, string>(); 13var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 16var header2 = new CookieHeaderValue("name2", ""); 19var header3 = new CookieHeaderValue("name3", "value3"); 22var header4 = new CookieHeaderValue("name4", "\"value4\""); 78public static TheoryData<IList<CookieHeaderValue>, string?[]> ListOfCookieHeaderDataSet 82var dataset = new TheoryData<IList<CookieHeaderValue>, string?[]>(); 83var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 86var header2 = new CookieHeaderValue("name2", "value2"); 89var header3 = new CookieHeaderValue("name3", "value3"); 92var header4 = new CookieHeaderValue("name4", "\"value4\""); 110public static TheoryData<IList<CookieHeaderValue>?, string?[]> ListWithInvalidCookieHeaderDataSet 114var dataset = new TheoryData<IList<CookieHeaderValue>?, string?[]>(); 115var header1 = new CookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3"); 118var header2 = new CookieHeaderValue("name2", "value2"); 121var header3 = new CookieHeaderValue("name3", "value3"); 174var header = new CookieHeaderValue("cookie"); 185var header = new CookieHeaderValue(name, value); 193var cookie = new CookieHeaderValue("name"); 202public void CookieHeaderValue_ToString(CookieHeaderValue input, string expectedValue) 209public void CookieHeaderValue_Parse_AcceptsValidValues(CookieHeaderValue cookie, string expectedValue) 211var header = CookieHeaderValue.Parse(expectedValue); 219public void CookieHeaderValue_TryParse_AcceptsValidValues(CookieHeaderValue cookie, string expectedValue) 221Assert.True(CookieHeaderValue.TryParse(expectedValue, out var header)); 231Assert.Throws<FormatException>(() => CookieHeaderValue.Parse(value)); 238Assert.False(CookieHeaderValue.TryParse(value, out var _)); 243public void CookieHeaderValue_ParseList_AcceptsValidValues(IList<CookieHeaderValue> cookies, string[] input) 245var results = CookieHeaderValue.ParseList(input); 252public void CookieHeaderValue_ParseStrictList_AcceptsValidValues(IList<CookieHeaderValue> cookies, string[] input) 254var results = CookieHeaderValue.ParseStrictList(input); 261public void CookieHeaderValue_TryParseList_AcceptsValidValues(IList<CookieHeaderValue> cookies, string[] input) 263var result = CookieHeaderValue.TryParseList(input, out var results); 271public void CookieHeaderValue_TryParseStrictList_AcceptsValidValues(IList<CookieHeaderValue> cookies, string[] input) 273var result = CookieHeaderValue.TryParseStrictList(input, out var results); 281public void CookieHeaderValue_ParseList_ExcludesInvalidValues(IList<CookieHeaderValue>? cookies, string[] input) 283var results = CookieHeaderValue.ParseList(input); 285Assert.Equal(cookies ?? new List<CookieHeaderValue>(), results); 290public void CookieHeaderValue_TryParseList_ExcludesInvalidValues(IList<CookieHeaderValue>? cookies, string[] input) 292var result = CookieHeaderValue.TryParseList(input, out var results); 301IList<CookieHeaderValue>? cookies, 305Assert.Throws<FormatException>(() => CookieHeaderValue.ParseStrictList(input)); 312IList<CookieHeaderValue>? cookies, 316var result = CookieHeaderValue.TryParseStrictList(input, out var results);