209 references to HeaderUtilities
Microsoft.AspNetCore.HeaderParsing (1)
Parsers\DateTimeOffsetParser.cs (1)
17if (values.Count != 1 || !HeaderUtilities.TryParseDate(values[0], out var parsedValue))
Microsoft.AspNetCore.Http (3)
Features\FormFeature.cs (1)
380var boundary = HeaderUtilities.RemoveQuotes(contentType.Boundary);
HeaderDictionary.cs (2)
127HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 139this[HeaderNames.ContentLength] = HeaderUtilities.FormatNonNegativeInt64(value.GetValueOrDefault());
Microsoft.AspNetCore.Http.Extensions (4)
HeaderDictionaryTypeExtensions.cs (3)
127headers[name] = HeaderUtilities.FormatDate(value.GetValueOrDefault()); 149private static DateTimeOffset? ParseCacheDateTimeOffset(string value) => HeaderUtilities.TryParseDate(value, out var result) ? result : null; 151private static long? ParseCacheInt64(string value) => HeaderUtilities.TryParseNonNegativeInt64(value, out var result) ? result : null;
HttpRequestMultipartExtensions.cs (1)
26return HeaderUtilities.RemoveQuotes(mediaType.Boundary).ToString();
Microsoft.AspNetCore.Http.Microbenchmarks (2)
HeaderUtilitiesBenchmark.cs (2)
14return HeaderUtilities.UnescapeAsQuotedString("\"hello\\\"foo\\\\bar\\\\baz\\\\\""); 20return HeaderUtilities.EscapeAsQuotedString("\"hello\\\"foo\\\\bar\\\\baz\\\\\"");
Microsoft.AspNetCore.Mvc.Core.Test (2)
FileResultHelperTest.cs (2)
405httpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(ifModifiedSince); 443httpContext.Request.Headers.IfUnmodifiedSince = HeaderUtilities.FormatDate(ifUnmodifiedSince);
Microsoft.AspNetCore.OutputCaching (6)
OutputCacheMiddleware.cs (6)
307response.Headers.Age = HeaderUtilities.FormatNonNegativeInt64(context.CachedEntryAge.Ticks / TimeSpan.TicksPerSecond); 364if (HeaderUtilities.ContainsCacheDirective(cacheContext.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.OnlyIfCachedString)) 400headers.Date = HeaderUtilities.FormatDate(context.ResponseTime!.Value); 555if (!HeaderUtilities.TryParseDate(cachedResponse.FindHeader(HeaderNames.LastModified).ToString(), out var modified) && 556!HeaderUtilities.TryParseDate(cachedResponse.FindHeader(HeaderNames.Date).ToString(), out modified)) 561if (HeaderUtilities.TryParseDate(ifModifiedSince.ToString(), out var modifiedSince) &&
Microsoft.AspNetCore.OutputCaching.Tests (20)
OutputCacheMiddlewareTests.cs (16)
179context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 183entry.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.Date] = HeaderUtilities.FormatDate(value) }); 217context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 223[HeaderNames.Date] = HeaderUtilities.FormatDate(date), 224[HeaderNames.LastModified] = HeaderUtilities.FormatDate(lastModified), 260context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 261entry.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)) }); 281context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 282context.CachedResponse.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)) }); 433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 547Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date); 562context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 565Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date); 569Assert.Equal(HeaderUtilities.FormatDate(responseTime), context.HttpContext.Response.Headers.Date);
OutputCachePolicyProviderTests.cs (4)
339context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 361context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 362context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 385context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow);
Microsoft.AspNetCore.Owin (2)
DictionaryStringValuesWrapper.cs (2)
57HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 68Inner[HeaderNames.ContentLength] = (StringValues)HeaderUtilities.FormatNonNegativeInt64(value.GetValueOrDefault());
Microsoft.AspNetCore.ResponseCaching (26)
ResponseCachingContext.cs (4)
65if (HeaderUtilities.TryParseDate(HttpContext.Response.Headers.Date.ToString(), out date)) 92if (HeaderUtilities.TryParseDate(HttpContext.Response.Headers.Expires.ToString(), out expires)) 112HeaderUtilities.TryParseSeconds(HttpContext.Response.Headers.CacheControl, CacheControlHeaderValue.SharedMaxAgeString, out _responseSharedMaxAge); 125HeaderUtilities.TryParseSeconds(HttpContext.Response.Headers.CacheControl, CacheControlHeaderValue.MaxAgeString, out _responseMaxAge);
ResponseCachingMiddleware.cs (6)
181response.Headers.Age = HeaderUtilities.FormatNonNegativeInt64(context.CachedEntryAge.Value.Ticks / TimeSpan.TicksPerSecond); 230if (HeaderUtilities.ContainsCacheDirective(context.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.OnlyIfCachedString)) 301headers.Date = HeaderUtilities.FormatDate(context.ResponseDate.Value); 463if (!HeaderUtilities.TryParseDate(cachedResponseHeaders.LastModified.ToString(), out modified) && 464!HeaderUtilities.TryParseDate(cachedResponseHeaders.Date.ToString(), out modified)) 470if (HeaderUtilities.TryParseDate(ifModifiedSince.ToString(), out modifiedSince) &&
ResponseCachingPolicyProvider.cs (16)
41if (HeaderUtilities.ContainsCacheDirective(cacheControl, CacheControlHeaderValue.NoCacheString)) 50if (HeaderUtilities.ContainsCacheDirective(requestHeaders.Pragma, CacheControlHeaderValue.NoCacheString)) 63return !HeaderUtilities.ContainsCacheDirective(context.HttpContext.Request.Headers.CacheControl, CacheControlHeaderValue.NoStoreString); 71if (!HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.PublicString)) 78if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.NoStoreString)) 85if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.NoCacheString)) 109if (HeaderUtilities.ContainsCacheDirective(responseCacheControlHeader, CacheControlHeaderValue.PrivateString)) 173if (HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MinFreshString, out var minFresh)) 181HeaderUtilities.TryParseSeconds(cachedCacheControlHeaders, CacheControlHeaderValue.SharedMaxAgeString, out cachedSharedMaxAge); 192HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MaxAgeString, out requestMaxAge); 195HeaderUtilities.TryParseSeconds(cachedCacheControlHeaders, CacheControlHeaderValue.MaxAgeString, out cachedMaxAge); 202if (HeaderUtilities.ContainsCacheDirective(cachedCacheControlHeaders, CacheControlHeaderValue.MustRevalidateString) 203|| HeaderUtilities.ContainsCacheDirective(cachedCacheControlHeaders, CacheControlHeaderValue.ProxyRevalidateString)) 210var maxStaleExist = HeaderUtilities.ContainsCacheDirective(requestCacheControlHeaders, CacheControlHeaderValue.MaxStaleString); 211HeaderUtilities.TryParseSeconds(requestCacheControlHeaders, CacheControlHeaderValue.MaxStaleString, out requestMaxStale); 234if (HeaderUtilities.TryParseDate(context.CachedResponseHeaders.Expires.ToString(), out expires) &&
Microsoft.AspNetCore.ResponseCaching.Tests (36)
ResponseCachingMiddlewareTests.cs (22)
195context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 198context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 203context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow); 208context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 226context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 229context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 230context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 235context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 236context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow); 241context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 242context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 261context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 262context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 280context.HttpContext.Request.Headers.IfModifiedSince = HeaderUtilities.FormatDate(utcNow); 281context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 459context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(now + TimeSpan.FromSeconds(11)); 484context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 509context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 631Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date); 643context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 646Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date); 650Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date);
ResponseCachingPolicyProviderTests.cs (14)
372context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 390context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 392context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 413context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 414context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 434context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 456context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 476context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 530context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow); 552context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 572context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 595context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow); 616context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow);
Microsoft.AspNetCore.Rewrite.Tests (1)
UrlActions\ChangeCookieActionTests.cs (1)
31Assert.Equal($"Cookie=Chocolate%20Chip; expires={HeaderUtilities.FormatDate(now.AddMinutes(1440))}; domain=contoso.com; path=/recipes; secure; httponly", header);
Microsoft.AspNetCore.Server.HttpSys (5)
RequestProcessing\RequestContext.FeatureCollection.cs (1)
700if (HeaderUtilities.TryParseDate(response.Headers[HeaderNames.Expires].ToString(), out expirationDate))
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (2)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 152_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (2)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 207_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
Microsoft.AspNetCore.Server.IIS (4)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (2)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 152_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (2)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 207_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
Microsoft.AspNetCore.Server.Kestrel.Core (14)
Internal\Http\DateHeaderValueManager.cs (1)
46var dateValue = HeaderUtilities.FormatDate(value);
Internal\Http\HttpHeaders.Generated.cs (11)
586return new StringValues(HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 3335value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value); 3354value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value); 7469array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 8649_current = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.GetValueOrDefault())); 8803return new StringValues(HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 11386value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value); 11396value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value); 14796array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 15482_current = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.GetValueOrDefault())); 17564array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
Internal\Http\HttpRequestHeaders.cs (1)
85if (!HeaderUtilities.TryParseNonNegativeInt64(value, out var parsed))
Internal\Http\HttpResponseHeaders.cs (1)
104if (!HeaderUtilities.TryParseNonNegativeInt64(value, out var parsed))
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
HttpHeadersTests.cs (1)
268Assert.Equal(HeaderUtilities.FormatNonNegativeInt64(long.MaxValue), value[0]);
KestrelServerTests.cs (1)
747Assert.Equal(HeaderUtilities.FormatDate(testContext.FakeTimeProvider.GetUtcNow()),
Microsoft.AspNetCore.Shared.Tests (4)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (2)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 152_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (2)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) 207_contentLengthText = HeaderUtilities.FormatNonNegativeInt64(value.Value);
Microsoft.AspNetCore.WebUtilities (4)
FileMultipartSection.cs (2)
40Name = HeaderUtilities.RemoveQuotes(_contentDispositionHeader.Name).ToString(); 41FileName = HeaderUtilities.RemoveQuotes(
FormMultipartSection.cs (1)
39Name = HeaderUtilities.RemoveQuotes(_contentDispositionHeader.Name).ToString();
MultipartReader.cs (1)
58boundary = HeaderUtilities.RemoveQuotes(new StringSegment(boundary)).ToString();
Microsoft.Net.Http.Headers (50)
BaseHeaderParser.cs (2)
31var current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, index, SupportsMultipleValues, 56current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, current, SupportsMultipleValues,
CacheControlHeaderValue.cs (6)
418if (!HeaderUtilities.AreEqualCollections(_noCacheHeaders, other._noCacheHeaders, 424if (!HeaderUtilities.AreEqualCollections(_privateHeaders, other._privateHeaders, 430if (!HeaderUtilities.AreEqualCollections(_extensions, other._extensions)) 734current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(valueString, current, true, 779if (!HeaderUtilities.TryParseNonNegativeInt32(nameValue.Value, out seconds)) 826HeaderUtilities.CheckValidToken(item, nameof(item));
ContentDispositionHeaderValue.cs (4)
162if (HeaderUtilities.TryParseNonNegativeInt64(sizeString, out var value)) 241HeaderUtilities.AreEqualCollections(_parameters, other._parameters); 387var dateString = HeaderUtilities.FormatDate(date.GetValueOrDefault(), quoted: true); 423return HeaderUtilities.RemoveQuotes(nameParameter.Value);
ContentRangeHeaderValue.cs (7)
56_unit = HeaderUtilities.BytesUnit; 70_unit = HeaderUtilities.BytesUnit; 90_unit = HeaderUtilities.BytesUnit; 102HeaderUtilities.CheckValidToken(value, nameof(value)); 394if ((fromLength > 0) && !HeaderUtilities.TryParseNonNegativeInt64(input.Subsegment(fromStartIndex, fromLength), out from)) 400if ((toLength > 0) && !HeaderUtilities.TryParseNonNegativeInt64(input.Subsegment(toStartIndex, toLength), out to)) 412if ((lengthLength > 0) && !HeaderUtilities.TryParseNonNegativeInt64(input.Subsegment(lengthStartIndex, lengthLength),
MediaTypeHeaderValue.cs (8)
80HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 132HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 156HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 209get => HeaderUtilities.GetQuality(_parameters); 212HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 213HeaderUtilities.SetQuality(Parameters, value); 230HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 484HeaderUtilities.AreEqualCollections(_parameters, other._parameters);
NameValueHeaderValue.cs (6)
72HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 179if (!HeaderUtilities.IsQuoted(_value)) 183return HeaderUtilities.UnescapeAsQuotedString(_value); 192HeaderUtilities.ThrowIfReadOnly(IsReadOnly); 199Value = HeaderUtilities.EscapeAsQuotedString(value); 477HeaderUtilities.CheckValidToken(name, nameof(name));
RangeConditionHeaderValue.cs (1)
76return HeaderUtilities.FormatDate(_lastModified.GetValueOrDefault());
RangeHeaderValue.cs (4)
31_unit = HeaderUtilities.BytesUnit; 42_unit = HeaderUtilities.BytesUnit; 55HeaderUtilities.CheckValidToken(value, nameof(value)); 113HeaderUtilities.AreEqualCollections(Ranges, other.Ranges);
RangeItemHeaderValue.cs (4)
118var current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, startIndex, true, separatorFound: out _); 138current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, current, true, out var separatorFound); 216if ((fromLength > 0) && !HeaderUtilities.TryParseNonNegativeInt64(input.Subsegment(fromStartIndex, fromLength), out from)) 223if ((toLength > 0) && !HeaderUtilities.TryParseNonNegativeInt64(input.Subsegment(toStartIndex, toLength), out to))
SetCookieHeaderValue.cs (5)
203maxAge = HeaderUtilities.FormatInt64((long)MaxAge.GetValueOrDefault().TotalSeconds); 345AppendSegment(builder, ExpiresToken, HeaderUtilities.FormatDate(Expires.GetValueOrDefault())); 350AppendSegment(builder, MaxAgeToken, HeaderUtilities.FormatInt64((long)MaxAge.GetValueOrDefault().TotalSeconds)); 579if (!HeaderUtilities.TryParseNonNegativeInt64(numberString, out maxAge)) 732&& HeaderUtilities.AreEqualCollections(_extensions, other._extensions, StringSegmentComparer.OrdinalIgnoreCase);
StringWithQualityHeaderValue.cs (3)
35HeaderUtilities.CheckValidToken(value, nameof(value)); 47HeaderUtilities.CheckValidToken(value, nameof(value)); 255if (!HeaderUtilities.TryParseQualityDouble(input, current, out var quality, out var qualityLength))
Microsoft.Net.Http.Headers.Tests (23)
DateParserTest.cs (4)
14Assert.True(HeaderUtilities.TryParseDate(input, out var result)); 30Assert.False(HeaderUtilities.TryParseDate(input, out var result)); 46HeaderUtilities.FormatDate(new DateTimeOffset(2010, 7, 31, 15, 38, 57, TimeSpan.Zero))); 49HeaderUtilities.FormatDate(new DateTimeOffset(2010, 1, 1, 1, 1, 1, TimeSpan.Zero)));
HeaderUtilitiesTest.cs (19)
19var actual = HeaderUtilities.FormatDate(dateTime, quoted); 76Assert.True(HeaderUtilities.TryParseSeconds(new StringValues(headerValues), targetValue, out value)); 96Assert.False(HeaderUtilities.TryParseSeconds(new StringValues(headerValues), targetValue!, out value)); 106Assert.Equal(value.ToString(CultureInfo.InvariantCulture), HeaderUtilities.FormatNonNegativeInt64(value)); 115Assert.Throws<ArgumentOutOfRangeException>(() => HeaderUtilities.FormatNonNegativeInt64(value)); 128Assert.Equal(value.ToString(CultureInfo.InvariantCulture), HeaderUtilities.FormatInt64(value)); 173Assert.Equal(contains, HeaderUtilities.ContainsCacheDirective(new StringValues(headerValues), targetValue!)); 186Assert.False(HeaderUtilities.TryParseNonNegativeInt64(valueString, out value)); 196Assert.True(HeaderUtilities.TryParseNonNegativeInt64(valueString, out value)); 211Assert.False(HeaderUtilities.TryParseNonNegativeInt32(valueString, out value)); 221Assert.True(HeaderUtilities.TryParseNonNegativeInt32(valueString, out value)); 232var actual = HeaderUtilities.RemoveQuotes(input); 243var actual = HeaderUtilities.IsQuoted(input); 259var actual = HeaderUtilities.UnescapeAsQuotedString(input); 276var actual = HeaderUtilities.EscapeAsQuotedString(input); 287Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString(input); }); 293Assert.Throws<FormatException>(() => { var actual = HeaderUtilities.EscapeAsQuotedString($"{(char)0x7F}"); }); 354var result = HeaderUtilities.TryParseQualityDouble(input, startIndex, out var actualQuality, out var actualLength); 406var result = HeaderUtilities.TryParseQualityDouble(input, startIndex, out var quality, out var length);