35 instantiations of SetCookieHeaderValue
Microsoft.AspNetCore.Http (1)
Internal\ResponseCookies.cs (1)
34var setCookieHeaderValue = new SetCookieHeaderValue(key, Uri.EscapeDataString(value))
Microsoft.AspNetCore.Http.Features (1)
CookieOptions.cs (1)
113var cookie = new SetCookieHeaderValue(name, value)
Microsoft.Net.Http.Headers (1)
SetCookieHeaderValue.cs (1)
485var result = new SetCookieHeaderValue();
Microsoft.Net.Http.Headers.Tests (32)
SetCookieHeaderValueTest.cs (32)
15var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 29var header2 = new SetCookieHeaderValue("name2", ""); 32var header3 = new SetCookieHeaderValue("name2", "value2"); 35var header4 = new SetCookieHeaderValue("name4", "value4") 41var header5 = new SetCookieHeaderValue("name5", "value5") 48var header6 = new SetCookieHeaderValue("name6", "value6") 54var header7 = new SetCookieHeaderValue("name7", "value7") 60var header8 = new SetCookieHeaderValue("name8", "value8"); 65var header9 = new SetCookieHeaderValue("name9", "value9") 71var header10 = new SetCookieHeaderValue("name10", "value10") 132var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 147var header2 = new SetCookieHeaderValue("name2", "value2"); 150var header3 = new SetCookieHeaderValue("name3", "value3") 156var header4 = new SetCookieHeaderValue("name4", "value4") 163var header5 = new SetCookieHeaderValue("name5", "value5") 170var header6 = new SetCookieHeaderValue("name6", "value6") 176var header7 = new SetCookieHeaderValue("name7", "value7") 182var header8 = new SetCookieHeaderValue("name8", "value8") 189var header9 = new SetCookieHeaderValue("name9", "value9"); 235var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 247var header2 = new SetCookieHeaderValue("name2", "value2"); 250var header3 = new SetCookieHeaderValue("name3", "value3") 256var header4 = new SetCookieHeaderValue("name4", "value4") 265var invalidHeader2a = new SetCookieHeaderValue("expires", "Sun"); 266var invalidHeader2b = new SetCookieHeaderValue("domain", "domain1"); 269var invalidHeader3 = new SetCookieHeaderValue("domain", "domain1") 300Assert.Throws<ArgumentNullException>(() => new SetCookieHeaderValue(null, "value")); 307Assert.Throws<ArgumentException>(() => new SetCookieHeaderValue(name, "value")); 314Assert.Throws<ArgumentException>(() => new SetCookieHeaderValue("name", value)); 320var header = new SetCookieHeaderValue("cookie"); 331var header = new SetCookieHeaderValue(name, value); 339var cookie = new SetCookieHeaderValue("name");
184 references to SetCookieHeaderValue
Microsoft.AspNetCore.Authentication.Test (15)
OpenIdConnect\OpenIdConnectChallengeTests.cs (3)
439var challengeCookies = SetCookieHeaderValue.ParseList(transaction.SetCookie); 440var nonceCookie = challengeCookies.Where(cookie => cookie.Name.StartsWith(OpenIdConnectDefaults.CookieNoncePrefix, StringComparison.Ordinal)).Single(); 448var correlationCookie = challengeCookies.Where(cookie => cookie.Name.StartsWith(".AspNetCore.Correlation.", StringComparison.Ordinal)).Single();
OpenIdConnect\OpenIdConnectEventTests.cs (1)
1016Assert.True(SetCookieHeaderValue.TryParseStrictList(values.ToList(), out var parsedValues));
OpenIdConnect\OpenIdConnectEventTests_Handler.cs (1)
1016Assert.True(SetCookieHeaderValue.TryParseStrictList(values.ToList(), out var parsedValues));
TwitterTests.cs (6)
213Assert.True(SetCookieHeaderValue.TryParseList(setCookie.ToList(), out var setCookieValues)); 215var setCookieValue = setCookieValues.Single(); 263Assert.True(SetCookieHeaderValue.TryParseList(setCookie.ToList(), out var setCookieValues)); 265var setCookieValue = setCookieValues.Single(); 370Assert.True(SetCookieHeaderValue.TryParseList(setCookie.ToList(), out var setCookieValues)); 372var setCookieValue = setCookieValues.Single();
WsFederation\WsFederationTest.cs (2)
264var cookies = SetCookieHeaderValue.ParseList(response.Headers.GetValues(HeaderNames.SetCookie).ToList()); 265foreach (var cookie in cookies)
WsFederation\WsFederationTest_Handler.cs (2)
262var cookies = SetCookieHeaderValue.ParseList(response.Headers.GetValues(HeaderNames.SetCookie).ToList()); 263foreach (var cookie in cookies)
Microsoft.AspNetCore.CookiePolicy.Test (30)
CookieConsentTests.cs (24)
217var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 219var consentCookie = cookies[0]; 226var testCookie = cookies[1]; 267var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 269var consentCookie = cookies[0]; 398var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 400var testCookie = cookies[0]; 405var consentCookie = cookies[1]; 445var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 447var consentCookie = cookies[0]; 510var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 512var testCookie = cookies[0]; 574var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 576var consentCookie = cookies[0]; 582cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]); 584var manualCookie = cookies[0]; 627var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 629var consentCookie = cookies[0]; 635cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]); 637var manualCookie = cookies[0]; 672var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie); 674var consentCookie = cookies[0]; 680cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]); 682var manualCookie = cookies[0];
CookiePolicyTests.cs (6)
400var cookie = SetCookieHeaderValue.Parse(transaction.SetCookie[0]); 452var cookie = SetCookieHeaderValue.Parse(transaction.SetCookie[0]); 460cookie = SetCookieHeaderValue.Parse(transaction.SetCookie[1]); 467cookie = SetCookieHeaderValue.Parse(transaction.SetCookie[2]);
Microsoft.AspNetCore.Http (1)
Internal\ResponseCookies.cs (1)
34var setCookieHeaderValue = new SetCookieHeaderValue(key, Uri.EscapeDataString(value))
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
CookieBuilderTests.cs (1)
66var cookie = options.CreateCookieHeader("name", "value");
Microsoft.AspNetCore.Http.Extensions (6)
HeaderDictionaryTypeExtensions.cs (4)
165private static IList<SetCookieHeaderValue> ParseSetCookieHeaderValue(IList<string> value) => 166SetCookieHeaderValue.TryParseList(value, out var result) ? result : Array.Empty<SetCookieHeaderValue>(); 253else if (typeof(T) == typeof(SetCookieHeaderValue))
ResponseHeaders.cs (2)
188public IList<SetCookieHeaderValue> SetCookie 192return Headers.SetCookie.GetList<SetCookieHeaderValue>();
Microsoft.AspNetCore.Http.Extensions.Tests (2)
HeaderDictionaryTypeExtensionsTest.cs (2)
243var result = context.Request.GetTypedHeaders().GetList<SetCookieHeaderValue>(HeaderNames.SetCookie); 245List<SetCookieHeaderValue> expected = [new("cookie1", "a"), new("cookie2", "b")];
Microsoft.AspNetCore.Http.Features (3)
CookieOptions.cs (3)
109/// Creates a <see cref="SetCookieHeaderValue"/> using the current options. 111public SetCookieHeaderValue CreateCookieHeader(string name, string value) 113var cookie = new SetCookieHeaderValue(name, value)
Microsoft.AspNetCore.Mvc.FunctionalTests (15)
TempDataInCookiesTest.cs (9)
79.Select(setCookieValue => SetCookieHeaderValue.Parse(setCookieValue)); 80foreach (var cookieTempDataProviderCookie in cookieTempDataProviderCookies) 96var setCookieHeaderValue = setCookieValues 97.Select(setCookieValue => SetCookieHeaderValue.Parse(setCookieValue)) 129var setCookieHeader = setCookieValues 130.Select(setCookieValue => SetCookieHeaderValue.Parse(setCookieValue)) 153.Select(setCookieValue => SetCookieHeaderValue.Parse(setCookieValue)) 182var setCookieHeader = setCookieValues 183.Select(setCookieValue => SetCookieHeaderValue.Parse(setCookieValue))
TempDataInCookiesUsingCookieConsentTest.cs (2)
112foreach (var cookie in SetCookieHeaderValue.ParseList(values.ToList()))
TempDataPropertyTest.cs (2)
165foreach (var cookie in SetCookieHeaderValue.ParseList(values.ToList()))
TempDataTestBase.cs (2)
268foreach (var cookie in SetCookieHeaderValue.ParseList(values.ToList()))
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (4)
CookieTempDataProviderTest.cs (4)
90var setCookieHeader = SetCookieHeaderValue.Parse(context.Response.Headers["Set-Cookie"].ToString()); 285var cookie = responseCookies.Single(); 327foreach (var cookie in responseCookies)
Microsoft.AspNetCore.Session.Tests (10)
SessionTests.cs (10)
203var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); 263var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); 321var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); 425var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First(); 494var cookie = SetCookieHeaderValue.ParseList(response.Headers.GetValues("Set-Cookie").ToList()).First();
Microsoft.Net.Http.Headers (26)
SetCookieHeaderValue.cs (26)
38private static readonly HttpHeaderParser<SetCookieHeaderValue> SingleValueParser 39= new GenericHeaderParser<SetCookieHeaderValue>(false, GetSetCookieLength); 40private static readonly HttpHeaderParser<SetCookieHeaderValue> MultipleValueParser 41= new GenericHeaderParser<SetCookieHeaderValue>(true, GetSetCookieLength); 53/// Initializes a new instance of <see cref="SetCookieHeaderValue"/>. 62/// Initializes a new instance of <see cref="SetCookieHeaderValue"/>. 330/// Append string representation of this <see cref="SetCookieHeaderValue"/> to given 335/// <see cref="SetCookieHeaderValue"/>. 408/// Parses <paramref name="input"/> as a <see cref="SetCookieHeaderValue"/> value. 412public static SetCookieHeaderValue Parse(StringSegment input) 419/// Attempts to parse the specified <paramref name="input"/> as a <see cref="SetCookieHeaderValue"/>. 423/// <returns><see langword="true"/> if input is a valid <see cref="SetCookieHeaderValue"/>, otherwise <see langword="false"/>.</returns> 424public static bool TryParse(StringSegment input, [NotNullWhen(true)] out SetCookieHeaderValue? parsedValue) 431/// Parses a sequence of inputs as a sequence of <see cref="SetCookieHeaderValue"/> values. 435public static IList<SetCookieHeaderValue> ParseList(IList<string>? inputs) 441/// Parses a sequence of inputs as a sequence of <see cref="SetCookieHeaderValue"/> values using string parsing rules. 445public static IList<SetCookieHeaderValue> ParseStrictList(IList<string>? inputs) 451/// Attempts to parse the sequence of values as a sequence of <see cref="SetCookieHeaderValue"/>. 455/// <returns><see langword="true"/> if all inputs are valid <see cref="SetCookieHeaderValue"/>, otherwise <see langword="false"/>.</returns> 456public static bool TryParseList(IList<string>? inputs, [NotNullWhen(true)] out IList<SetCookieHeaderValue>? parsedValues) 462/// Attempts to parse the sequence of values as a sequence of <see cref="SetCookieHeaderValue"/> using string parsing rules. 467public static bool TryParseStrictList(IList<string>? inputs, [NotNullWhen(true)] out IList<SetCookieHeaderValue>? parsedValues) 473private static int GetSetCookieLength(StringSegment input, int startIndex, out SetCookieHeaderValue? parsedValue) 485var result = new SetCookieHeaderValue(); 716var other = obj as SetCookieHeaderValue;
Microsoft.Net.Http.Headers.Tests (71)
SetCookieHeaderValueTest.cs (71)
10public static TheoryData<SetCookieHeaderValue, string> SetCookieHeaderDataSet 14var dataset = new TheoryData<SetCookieHeaderValue, string>(); 15var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 29var header2 = new SetCookieHeaderValue("name2", ""); 32var header3 = new SetCookieHeaderValue("name2", "value2"); 35var header4 = new SetCookieHeaderValue("name4", "value4") 41var header5 = new SetCookieHeaderValue("name5", "value5") 48var header6 = new SetCookieHeaderValue("name6", "value6") 54var header7 = new SetCookieHeaderValue("name7", "value7") 60var header8 = new SetCookieHeaderValue("name8", "value8"); 65var header9 = new SetCookieHeaderValue("name9", "value9") 71var header10 = new SetCookieHeaderValue("name10", "value10") 127public static TheoryData<IList<SetCookieHeaderValue>, string?[]> ListOfSetCookieHeaderDataSet 131var dataset = new TheoryData<IList<SetCookieHeaderValue>, string?[]>(); 132var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 147var header2 = new SetCookieHeaderValue("name2", "value2"); 150var header3 = new SetCookieHeaderValue("name3", "value3") 156var header4 = new SetCookieHeaderValue("name4", "value4") 163var header5 = new SetCookieHeaderValue("name5", "value5") 170var header6 = new SetCookieHeaderValue("name6", "value6") 176var header7 = new SetCookieHeaderValue("name7", "value7") 182var header8 = new SetCookieHeaderValue("name8", "value8") 189var header9 = new SetCookieHeaderValue("name9", "value9"); 213var pair_cookie1 = (SetCookieHeaderValue)item1[0]; 218var pair_cookie2 = (SetCookieHeaderValue)item2[0]; 230public static TheoryData<IList<SetCookieHeaderValue>?, string?[]> ListWithInvalidSetCookieHeaderDataSet 234var dataset = new TheoryData<IList<SetCookieHeaderValue>?, string?[]>(); 235var header1 = new SetCookieHeaderValue("name1", "n1=v1&n2=v2&n3=v3") 247var header2 = new SetCookieHeaderValue("name2", "value2"); 250var header3 = new SetCookieHeaderValue("name3", "value3") 256var header4 = new SetCookieHeaderValue("name4", "value4") 265var invalidHeader2a = new SetCookieHeaderValue("expires", "Sun"); 266var invalidHeader2b = new SetCookieHeaderValue("domain", "domain1"); 269var invalidHeader3 = new SetCookieHeaderValue("domain", "domain1") 320var header = new SetCookieHeaderValue("cookie"); 331var header = new SetCookieHeaderValue(name, value); 339var cookie = new SetCookieHeaderValue("name"); 348public void SetCookieHeaderValue_ToString(SetCookieHeaderValue input, string expectedValue) 355public void SetCookieHeaderValue_AppendToStringBuilder(SetCookieHeaderValue input, string expectedValue) 366public void SetCookieHeaderValue_Parse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue) 368var header = SetCookieHeaderValue.Parse(expectedValue); 376public void SetCookieHeaderValue_TryParse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue) 378Assert.True(SetCookieHeaderValue.TryParse(expectedValue, out var header)); 388Assert.Throws<FormatException>(() => SetCookieHeaderValue.Parse(value)); 395Assert.False(SetCookieHeaderValue.TryParse(value, out var _)); 400public void SetCookieHeaderValue_ParseList_AcceptsValidValues(IList<SetCookieHeaderValue> cookies, string[] input) 402var results = SetCookieHeaderValue.ParseList(input); 409public void SetCookieHeaderValue_TryParseList_AcceptsValidValues(IList<SetCookieHeaderValue> cookies, string[] input) 411bool result = SetCookieHeaderValue.TryParseList(input, out var results); 423SetCookieHeaderValue.TryParse(cookieHeaderValue1, out var setCookieHeaderValue1); 424SetCookieHeaderValue.TryParse(cookieHeaderValue2, out var setCookieHeaderValue2); 431public void SetCookieHeaderValue_ParseStrictList_AcceptsValidValues(IList<SetCookieHeaderValue> cookies, string[] input) 433var results = SetCookieHeaderValue.ParseStrictList(input); 440public void SetCookieHeaderValue_TryParseStrictList_AcceptsValidValues(IList<SetCookieHeaderValue> cookies, string[] input) 442bool result = SetCookieHeaderValue.TryParseStrictList(input, out var results); 450public void SetCookieHeaderValue_ParseList_ExcludesInvalidValues(IList<SetCookieHeaderValue>? cookies, string[] input) 452var results = SetCookieHeaderValue.ParseList(input); 454Assert.Equal(cookies ?? new List<SetCookieHeaderValue>(), results); 459public void SetCookieHeaderValue_TryParseList_ExcludesInvalidValues(IList<SetCookieHeaderValue>? cookies, string[] input) 461bool result = SetCookieHeaderValue.TryParseList(input, out var results); 470IList<SetCookieHeaderValue>? cookies, 474Assert.Throws<FormatException>(() => SetCookieHeaderValue.ParseStrictList(input)); 481IList<SetCookieHeaderValue>? cookies, 485bool result = SetCookieHeaderValue.TryParseStrictList(input, out var results);