183 references to AsSpan
Microsoft.AspNetCore.Authentication.Test (3)
OpenIdConnect\OpenIdConnectChallengeTests.cs (3)
444Assert.Equal("/signin-oidc", nonceCookie.Path.AsSpan()); 445Assert.Equal("N", nonceCookie.Value.AsSpan()); 452Assert.Equal("/signin-oidc", correlationCookie.Path.AsSpan());
Microsoft.AspNetCore.Components (1)
src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (1)
156if (!MatchComplexSegment(pathSegment, requestSegment.AsSpan(), values))
Microsoft.AspNetCore.CookiePolicy.Test (29)
CookieConsentTests.cs (20)
220Assert.Equal(".AspNet.Consent", consentCookie.Name.AsSpan()); 221Assert.Equal("yes", consentCookie.Value.AsSpan()); 227Assert.Equal("Test", testCookie.Name.AsSpan()); 228Assert.Equal("Value", testCookie.Value.AsSpan()); 270Assert.Equal(".AspNet.Consent1", consentCookie.Name.AsSpan()); 271Assert.Equal("yes1", consentCookie.Value.AsSpan()); 401Assert.Equal("Test", testCookie.Name.AsSpan()); 402Assert.Equal("Value1", testCookie.Value.AsSpan()); 406Assert.Equal(".AspNet.Consent", consentCookie.Name.AsSpan()); 407Assert.Equal("", consentCookie.Value.AsSpan()); 448Assert.Equal(".AspNet.Consent1", consentCookie.Name.AsSpan()); 449Assert.Equal("", consentCookie.Value.AsSpan()); 513Assert.Equal("Test", testCookie.Name.AsSpan()); 514Assert.Equal("", testCookie.Value.AsSpan()); 577Assert.Equal(".AspNet.Consent", consentCookie.Name.AsSpan()); 578Assert.Equal("yes", consentCookie.Value.AsSpan()); 630Assert.Equal(".AspNet.Consent1", consentCookie.Name.AsSpan()); 631Assert.Equal("yes1", consentCookie.Value.AsSpan()); 675Assert.Equal(".AspNet.Consent", consentCookie.Name.AsSpan()); 676Assert.Equal("true", consentCookie.Value.AsSpan());
CookiePolicyTests.cs (9)
401Assert.Equal("TestCookie", cookie.Name.AsSpan()); 404Assert.Equal("/", cookie.Path.AsSpan()); 453Assert.Equal("TestCookie", cookie.Name.AsSpan()); 454Assert.Equal("chunks-2", cookie.Value.AsSpan()); 457Assert.Equal("/", cookie.Path.AsSpan()); 461Assert.Equal("TestCookieC1", cookie.Name.AsSpan()); 464Assert.Equal("/", cookie.Path.AsSpan()); 468Assert.Equal("TestCookieC2", cookie.Name.AsSpan()); 471Assert.Equal("/", cookie.Path.AsSpan());
Microsoft.AspNetCore.Http (1)
src\Shared\HttpRuleParser.cs (1)
189ReadOnlySpan<char> inputSpan = input.AsSpan();
Microsoft.AspNetCore.Http.Abstractions (2)
HostString.cs (2)
112&& int.TryParse(port.AsSpan(), NumberStyles.None, CultureInfo.InvariantCulture, out var p)) 153: string.Concat(encoded, ":", port.AsSpan());
Microsoft.AspNetCore.Http.Abstractions.Tests (2)
CookieBuilderTests.cs (2)
67Assert.Equal("name", cookie.Name.AsSpan()); 68Assert.Equal("value", cookie.Value.AsSpan());
Microsoft.AspNetCore.Mvc.Core (2)
Formatters\MediaType.cs (1)
281parameter.Value.AsSpan(), NumberStyles.AllowDecimalPoint,
src\Shared\HttpRuleParser.cs (1)
189ReadOnlySpan<char> inputSpan = input.AsSpan();
Microsoft.AspNetCore.Mvc.FunctionalTests (7)
TempDataInCookiesTest.cs (7)
83Assert.Equal("/", cookieTempDataProviderCookie.Path.AsSpan()); 100Assert.Equal(string.Empty, setCookieHeaderValue.Value.AsSpan()); 101Assert.Equal("/", setCookieHeaderValue.Path.AsSpan()); 133Assert.Equal("/", setCookieHeader.Path.AsSpan()); 156Assert.Equal(string.Empty, setCookieHeader.Value.AsSpan()); 157Assert.Equal("/", setCookieHeader.Path.AsSpan()); 186Assert.Equal("/", setCookieHeader.Path.AsSpan());
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (4)
CookieTempDataProviderTest.cs (4)
287Assert.Equal(CookieTempDataProvider.CookieName, cookie.Name.AsSpan()); 288Assert.Equal(string.Empty, cookie.Value.AsSpan()); 329stringBuilder.Append(cookie.Name.AsSpan()); 331stringBuilder.Append(cookie.Value.AsSpan());
Microsoft.AspNetCore.Routing (3)
Matching\NegotiationMatcherPolicy.cs (1)
120if (MemoryExtensions.Equals(metadata.AsSpan(), value.Value.AsSpan(), StringComparison.OrdinalIgnoreCase))
Patterns\RoutePatternMatcher.cs (1)
156if (!MatchComplexSegment(pathSegment, requestSegment.AsSpan(), values))
src\Shared\HttpRuleParser.cs (1)
189ReadOnlySpan<char> inputSpan = input.AsSpan();
Microsoft.Extensions.Primitives (13)
StringSegment.cs (12)
183return a.AsSpan().CompareTo(b.AsSpan(), comparisonType); 219return AsSpan().Equals(other.AsSpan(), comparisonType); 262return AsSpan().Equals(text.AsSpan(), comparisonType); 275return string.GetHashCode(AsSpan()); 313public static implicit operator ReadOnlySpan<char>(StringSegment segment) => segment.AsSpan(); 344return AsSpan().StartsWith(text.AsSpan(), comparisonType); 370return AsSpan().EndsWith(text.AsSpan(), comparisonType); 578return AsSpan().LastIndexOf(value); 593ReadOnlySpan<char> span = AsSpan(); 613ReadOnlySpan<char> span = AsSpan();
StringSegmentComparer.cs (1)
65return string.GetHashCode(obj.AsSpan(), Comparison);
Microsoft.Net.Http.Headers (23)
CacheControlHeaderValue.cs (1)
820sb.Append(value.AsSpan());
ContentDispositionHeaderValue.cs (4)
538return input.AsSpan().IndexOfAnyExceptInRange((char)0x20, (char)0x7e) >= 0; 547Base64.GetMaxEncodedToUtf8Length(Encoding.UTF8.GetByteCount(input.AsSpan())) + 557var contentLength = Encoding.UTF8.GetBytes(input.AsSpan(), bufferContent); 621var remaining = input.AsSpan();
ContentRangeHeaderValue.cs (1)
177sb.Append(Unit.AsSpan());
CookieHeaderValue.cs (2)
93header.Append(_name.AsSpan()); 95header.Append(_value.AsSpan());
HeaderUtilities.cs (2)
378return int.TryParse(value.AsSpan(), NumberStyles.None, NumberFormatInfo.InvariantInfo, out result); 403return long.TryParse(value.AsSpan(), NumberStyles.None, NumberFormatInfo.InvariantInfo, out result);
MediaTypeHeaderValue.cs (3)
468builder.Append(_mediaType.AsSpan()); 647mediaType = string.Concat(input.AsSpan().Slice(startIndex, typeLength), "/", input.AsSpan().Slice(current, subtypeLength));
NameValueHeaderValue.cs (2)
298destination.Append(values[i].Name.AsSpan()); 302destination.Append(values[i].Value.AsSpan());
RangeHeaderValue.cs (1)
79sb.Append(_unit.AsSpan());
SetCookieHeaderValue.cs (6)
315Append(ref span, name.AsSpan()); 319Append(ref span, value.AsSpan()); 339builder.Append(_name.AsSpan()); 341builder.Append(_value.AsSpan()); 399builder.Append(name.AsSpan()); 403builder.Append(value.AsSpan());
src\Shared\HttpRuleParser.cs (1)
189ReadOnlySpan<char> inputSpan = input.AsSpan();
Microsoft.Net.Http.Headers.Tests (93)
CacheControlHeaderValueTest.cs (2)
50Assert.Equal("PLACEHOLDER", cacheControl.NoCacheHeaders.First().AsSpan()); 57Assert.Equal("PLACEHOLDER", cacheControl.PrivateHeaders.First().AsSpan());
ContentDispositionHeaderValueTest.cs (47)
45Assert.Equal("inline", contentDisposition.DispositionType.AsSpan()); 66Assert.Equal("inline", contentDisposition.DispositionType.AsSpan()); 69Assert.Equal("attachment", contentDisposition.DispositionType.AsSpan()); 77Assert.Equal("myname", contentDisposition.Name.AsSpan()); 79Assert.Equal("name", contentDisposition.Parameters.First().Name.AsSpan()); 96Assert.Equal("NAME", contentDisposition.Parameters.First().Name.AsSpan()); 99Assert.Equal("new_name", contentDisposition.Name.AsSpan()); 101Assert.Equal("NAME", contentDisposition.Parameters.First().Name.AsSpan()); 116Assert.Equal("FILENAME", contentDisposition.Parameters.First().Name.AsSpan()); 119Assert.Equal("new_name", contentDisposition.FileName.AsSpan()); 121Assert.Equal("FILENAME", contentDisposition.Parameters.First().Name.AsSpan()); 133Assert.Equal("FileÃName.bat", contentDisposition.FileName.AsSpan()); 135Assert.Equal("filename", contentDisposition.Parameters.First().Name.AsSpan()); 136Assert.Equal("\"=?utf-8?B?RmlsZcODTmFtZS5iYXQ=?=\"", contentDisposition.Parameters.First().Value.AsSpan()); 148Assert.Equal("File\nName.bat", contentDisposition.FileName.AsSpan()); 150Assert.Equal("filename", contentDisposition.Parameters.First().Name.AsSpan()); 151Assert.Equal("\"=?utf-8?B?RmlsZQpOYW1lLmJhdA==?=\"", contentDisposition.Parameters.First().Value.AsSpan()); 166Assert.Equal("FILENAME", contentDisposition.Parameters.First().Name.AsSpan()); 167Assert.Equal("\"=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=\"", contentDisposition.Parameters.First().Value.AsSpan()); 168Assert.Equal("=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=", contentDisposition.FileName.AsSpan()); 171Assert.Equal("new_name", contentDisposition.FileName.AsSpan()); 173Assert.Equal("FILENAME", contentDisposition.Parameters.First().Name.AsSpan()); 188Assert.Equal("FILENAME*", contentDisposition.Parameters.First().Name.AsSpan()); 192Assert.Equal("new_name", contentDisposition.FileNameStar.AsSpan()); 194Assert.Equal("FILENAME*", contentDisposition.Parameters.First().Name.AsSpan()); 195Assert.Equal("UTF-8\'\'new_name", contentDisposition.Parameters.First().Value.AsSpan()); 207Assert.Equal("FileÃName.bat", contentDisposition.FileNameStar.AsSpan()); 209Assert.Equal("filename*", contentDisposition.Parameters.First().Name.AsSpan()); 210Assert.Equal("UTF-8\'\'File%C3%83Name.bat", contentDisposition.Parameters.First().Value.AsSpan()); 221Assert.Equal($"UTF-8\'\'a%C2%80b", contentDisposition.Parameters.First().Value.AsSpan()); //%C2 added because the value in UTF-8 is encoded on 2 bytes. 229Assert.Equal($"UTF-8\'\'{new string('a', 400)}", contentDisposition.Parameters.First().Value.AsSpan()); 253Assert.Equal($"UTF-8\'\'a%{hexC}b", contentDisposition.Parameters.First().Value.AsSpan()); 257Assert.Equal($"UTF-8\'\'a{(char)b}b", contentDisposition.Parameters.First().Value.AsSpan()); 272Assert.Equal("FILENAME*", contentDisposition.Parameters.First().Name.AsSpan()); 273Assert.Equal("utf-99'lang'File%CZName.bat", contentDisposition.Parameters.First().Value.AsSpan()); 277Assert.Equal("new_name", contentDisposition.FileNameStar.AsSpan()); 279Assert.Equal("FILENAME*", contentDisposition.Parameters.First().Name.AsSpan()); 313Assert.Equal("Creation-DATE", contentDisposition.Parameters.First().Name.AsSpan()); 321Assert.Equal("Creation-DATE", contentDisposition.Parameters.First().Name.AsSpan()); 322Assert.Equal("\"Tue, 15 Nov 1994 08:12:32 GMT\"", contentDisposition.Parameters.First().Value.AsSpan()); 339Assert.Equal("read-DATE", contentDisposition.Parameters.First().Name.AsSpan()); 357Assert.Equal("SIZE", contentDisposition.Parameters.First().Name.AsSpan()); 363Assert.Equal("SIZE", contentDisposition.Parameters.First().Name.AsSpan()); 378Assert.Equal("SIZE", contentDisposition.Parameters.First().Name.AsSpan()); 385Assert.Equal("SIZE", contentDisposition.Parameters.First().Name.AsSpan()); 658Assert.Equal("File __ name.txt", contentDisposition.FileName.AsSpan()); 660Assert.Equal("UTF-8\'\'File%20%F0%9F%A4%A9%20name.txt", contentDisposition.Parameters[1].Value.AsSpan());
ContentRangeHeaderValueTest.cs (6)
21Assert.Equal("bytes", range.Unit.AsSpan()); 42Assert.Equal("bytes", range.Unit.AsSpan()); 66Assert.Equal("bytes", range.Unit.AsSpan()); 77Assert.Equal("myunit", range.Unit.AsSpan()); 159Assert.Equal("bytes", result.Unit.AsSpan()); 190Assert.Equal("bytes", result.Unit.AsSpan());
CookieHeaderValueTest.cs (6)
175Assert.Equal("cookie", header.Name.AsSpan()); 176Assert.Equal(string.Empty, header.Value.AsSpan()); 186Assert.Equal(name, header.Name.AsSpan()); 187Assert.Equal(value, header.Value.AsSpan()); 194Assert.Equal(string.Empty, cookie.Value.AsSpan()); 197Assert.Equal("value1", cookie.Value.AsSpan());
MediaTypeHeaderValueTest.cs (14)
105Assert.Equal("text/plain", mediaType.MediaType.AsSpan()); 115Assert.Equal("application/xml", mediaType.MediaType.AsSpan()); 224Assert.Equal("text/plain", mediaType.MediaType.AsSpan()); 227Assert.Equal("application/xml", mediaType.MediaType.AsSpan()); 235Assert.Equal("mycharset", mediaType.Charset.AsSpan()); 237Assert.Equal("charset", mediaType.Parameters.First().Name.AsSpan()); 254Assert.Equal("CHARSET", mediaType.Parameters.First().Name.AsSpan()); 257Assert.Equal("new_charset", mediaType.Charset.AsSpan()); 259Assert.Equal("CHARSET", mediaType.Parameters.First().Name.AsSpan()); 272Assert.Equal("q", mediaType.Parameters.First().Name.AsSpan()); 273Assert.Equal("0.563", mediaType.Parameters.First().Value.AsSpan()); 289Assert.Equal("q", mediaType.Parameters.First().Name.AsSpan()); 295Assert.Equal("q", mediaType.Parameters.First().Name.AsSpan()); 309Assert.Equal("Q", mediaType.Parameters.First().Name.AsSpan());
NameValueHeaderValueTest.cs (9)
32Assert.Equal("text", nameValue.Name.AsSpan()); 69Assert.Equal("othervalue", pair0.Value.AsSpan()); 87Assert.Equal("othervalue", pair0.Value.AsSpan()); 103Assert.Equal("othervalue", pair0.Value.AsSpan()); 104Assert.Equal("value", pair1.Value.AsSpan()); 120Assert.Equal("othervalue", pair0.Value.AsSpan()); 121Assert.Equal("value", pair1.Value.AsSpan()); 137Assert.Equal("othervalue", pair2.Value.AsSpan()); 138Assert.Equal("value", pair1.Value.AsSpan());
RangeHeaderValueTest.cs (1)
19Assert.Equal("myunit", range.Unit.AsSpan());
SetCookieHeaderValueTest.cs (6)
321Assert.Equal("cookie", header.Name.AsSpan()); 322Assert.Equal(string.Empty, header.Value.AsSpan()); 332Assert.Equal(name, header.Name.AsSpan()); 333Assert.Equal(value, header.Value.AsSpan()); 340Assert.Equal(string.Empty, cookie.Value.AsSpan()); 343Assert.Equal("value1", cookie.Value.AsSpan());
StringWithQualityHeaderValueTest.cs (2)
12Assert.Equal("token", value.Value.AsSpan()); 24Assert.Equal("token", value.Value.AsSpan());