1 override of Headers
Microsoft.AspNetCore.Http (1)
1014 references to Headers
Aspire.Dashboard (5)
Aspire.Dashboard.Tests (7)
BasicWebSite (3)
Binding.Http.IntegrationTests (1)
blazor-devserver (3)
CookiePolicySample (1)
FormatterWebSite (1)
GenericHostWebSite (1)
Http3SampleApp (1)
HttpLogging.Sample (1)
HttpStress (2)
InMemory.FunctionalTests (137)
Http2\Http2StreamTests.cs (40)
360context.Response.Headers["path"] = context.Request.Path.Value;
361context.Response.Headers["query"] = context.Request.QueryString.Value;
362context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
2144Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
2146Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
2147Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
2185Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
2186Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
2188context.Response.Headers.Append("CustomName", "Custom 你好 Value");
2229context.Response.Headers.Append("CustomName", "Custom 你好 Value");
2845context.Response.Headers["too_long_header"] = value;
3529context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3565context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3566context.Response.Headers.TE = new string('a', 30);
3603context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3604context.Response.Headers.TE = new string('b', (int)Http2PeerSettings.DefaultMaxFrameSize);
3654context.Response.Headers.ETag = new string('a', 17002);
3683context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize - 20);
3716context.Response.Headers[longHeaderName] = headerValue;
3755context.Response.Headers["my"] = headerValue;
4747Assert.True(context.Response.Headers.IsReadOnly);
4803Assert.True(context.Response.Headers.IsReadOnly);
4871Assert.False(context.Response.Headers.IsReadOnly);
4921Assert.True(context.Response.Headers.IsReadOnly);
4987Assert.True(context.Response.Headers.IsReadOnly);
5043Assert.True(context.Response.Headers.IsReadOnly);
5160Assert.False(context.Response.Headers.IsReadOnly);
5166Assert.True(context.Response.Headers.IsReadOnly);
5236Assert.True(context.Response.Headers.IsReadOnly);
5311Assert.True(context.Response.Headers.IsReadOnly);
5382Assert.True(context.Response.Headers.IsReadOnly);
5451Assert.True(context.Response.Headers.IsReadOnly);
5533Assert.True(context.Response.Headers.IsReadOnly);
5615Assert.True(context.Response.Headers.IsReadOnly);
5699Assert.True(context.Response.Headers.IsReadOnly);
5845response.Headers.Add(HeaderNames.TransferEncoding, "chunked");
5846response.Headers.Add(HeaderNames.Upgrade, "websocket");
5847response.Headers.Add(HeaderNames.Connection, "Keep-Alive");
5848response.Headers.Add(HeaderNames.KeepAlive, "timeout=5, max=1000");
5849response.Headers.Add(HeaderNames.ProxyConnection, "keep-alive");
Http3\Http3StreamTests.cs (32)
208context.Response.Headers["path"] = context.Request.Path.Value;
209context.Response.Headers["query"] = context.Request.QueryString.Value;
210context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
660response.Headers.Add(HeaderNames.TransferEncoding, "chunked");
661response.Headers.Add(HeaderNames.Upgrade, "websocket");
662response.Headers.Add(HeaderNames.Connection, "Keep-Alive");
663response.Headers.Add(HeaderNames.KeepAlive, "timeout=5, max=1000");
664response.Headers.Add(HeaderNames.ProxyConnection, "keep-alive");
862Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
864Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
865Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
896Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
897Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
899context.Response.Headers.Append("CustomName", "Custom 你好 Value");
931context.Response.Headers.Append("CustomName", "Custom 你好 Value");
1143Assert.True(context.Response.Headers.IsReadOnly);
1192Assert.True(context.Response.Headers.IsReadOnly);
1246Assert.False(context.Response.Headers.IsReadOnly);
1289Assert.True(context.Response.Headers.IsReadOnly);
1342Assert.True(context.Response.Headers.IsReadOnly);
1391Assert.True(context.Response.Headers.IsReadOnly);
1487Assert.False(context.Response.Headers.IsReadOnly);
1493Assert.True(context.Response.Headers.IsReadOnly);
1544Assert.True(context.Response.Headers.IsReadOnly);
1600Assert.True(context.Response.Headers.IsReadOnly);
1658Assert.True(context.Response.Headers.IsReadOnly);
1714Assert.True(context.Response.Headers.IsReadOnly);
1775Assert.True(context.Response.Headers.IsReadOnly);
1837Assert.True(context.Response.Headers.IsReadOnly);
1902Assert.True(context.Response.Headers.IsReadOnly);
2789context.Response.Headers["BigHeader"] = new string('!', 100);
2901c.Response.Headers["Header" + i] = i + "-" + headerText;
ResponseHeaderTests.cs (13)
23Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
25Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Accept = "Custom 你好 Accept"); // Not special cased
26Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
27Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
54Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
55Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
57context.Response.Headers.Accept = "Custom 你好 Accept";
58context.Response.Headers.Append("CustomName", "Custom 你好 Value");
91context.Response.Headers.Append("CustomName", "Custom 你好 Value");
112Assert.Equal(0, context.Response.Headers[tag].Count);
114context.Response.Headers.Add(tag, new StringValues((string)null));
116Assert.Equal(0, context.Response.Headers[tag].Count);
119context.Response.Headers.Add(tag, new StringValues("Hello"));
InProcessWebSite (10)
Interop.FunctionalTests (4)
JwtBearerSample (1)
LocalizationWebsite (2)
Microsoft.AspNetCore.Antiforgery (5)
Microsoft.AspNetCore.Antiforgery.Test (23)
DefaultAntiforgeryTest.cs (23)
311Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
312Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
326context.HttpContext.Response.Headers.CacheControl = "public";
342Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
343Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
363context.HttpContext.Response.Headers[headerName] = headerValue;
367return context.HttpContext.Response.Headers[headerName].ToString();
504Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
505Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
997context.HttpContext.Response.Headers["X-Frame-Options"] = expectedHeaderValue;
1003var xFrameOptions = context.HttpContext.Response.Headers["X-Frame-Options"];
1026Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1027Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1049Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1050Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1067context.HttpContext.Response.Headers["Cache-Control"] = "public";
1073Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1074Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1103var xFrameOptions = context.HttpContext.Response.Headers["X-Frame-Options"];
1266context.HttpContext.Response.Headers["Cache-Control"] = "public";
1272Assert.Equal("public", context.HttpContext.Response.Headers["Cache-Control"]);
1332context.HttpContext.Response.Headers[headerName] = headerValue;
1366context.HttpContext.Response.Headers[headerName] = headerValue;
Microsoft.AspNetCore.Authentication.Cookies (8)
Microsoft.AspNetCore.Authentication.JwtBearer (2)
Microsoft.AspNetCore.Authentication.Negotiate (3)
Microsoft.AspNetCore.Authentication.Negotiate.Test (31)
EventTests.cs (17)
33Assert.False(context.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
42Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
56context.Response.Headers.WWWAuthenticate = "Teapot";
66Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
104context.Response.Headers.WWWAuthenticate = "Teapot";
114Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
154context.Response.Headers.WWWAuthenticate = "Teapot";
164Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
204context.Response.Headers.WWWAuthenticate = "Teapot";
214Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
254context.Response.Headers.WWWAuthenticate = "Teapot";
264Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
294Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
340Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
364Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
399Assert.Equal("Negotiate ServerKerberosBlob1", result.Response.Headers.WWWAuthenticate);
406Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers.WWWAuthenticate);
NegotiateHandlerTests.cs (14)
61Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
73Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
83Assert.Equal("Negotiate ServerNtlmBlob1", result.Response.Headers.WWWAuthenticate);
165Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
192Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
290Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
301Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
312Assert.DoesNotContain(HeaderNames.WWWAuthenticate, result.Response.Headers);
329Assert.Equal("Negotiate ServerKerberosBlob", result.Response.Headers.WWWAuthenticate);
337Assert.Equal("Negotiate ServerKerberosBlob", result.Response.Headers.WWWAuthenticate);
350Assert.Equal("Negotiate ServerKerberosBlob1", result.Response.Headers.WWWAuthenticate);
357Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers.WWWAuthenticate);
370Assert.Equal("Negotiate ServerNtlmBlob1", result.Response.Headers.WWWAuthenticate);
377Assert.Equal("Negotiate ServerNtlmBlob2", result.Response.Headers.WWWAuthenticate);
Microsoft.AspNetCore.Authentication.OAuth (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
Microsoft.AspNetCore.Authentication.Test (3)
Microsoft.AspNetCore.Components.Endpoints (11)
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
Microsoft.AspNetCore.Components.Server (1)
Microsoft.AspNetCore.Components.WebAssembly.Server (8)
Microsoft.AspNetCore.Components.WebAssembly.Server.Tests (18)
ContentEncodingNegotiatorTests.cs (18)
29Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
31Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
51Assert.False(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
52Assert.False(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
72Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
74Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
95Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
97Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
118Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
120Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
141Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
143Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
164Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
166Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
186Assert.False(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
187Assert.False(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
207Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.ContentEncoding, out var selectedEncoding));
209Assert.True(httpContext.Response.Headers.TryGetValue(HeaderNames.Vary, out var varyHeader));
Microsoft.AspNetCore.CookiePolicy.Test (40)
CookieConsentTests.cs (27)
30Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
49Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
68Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
94Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
113Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
143Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
166Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
189Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
217var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
267var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
305Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
338Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
366Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
398var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
445var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
489Assert.Equal("Test=Value1; path=/", httpContext.Response.Headers.SetCookie);
510var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
544Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
569context.Response.Headers["ManualCookie"] = cookie;
574var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
582cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
622context.Response.Headers["ManualCookie"] = cookie;
627var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
635cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
667context.Response.Headers["ManualCookie"] = cookie;
672var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
680cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
Microsoft.AspNetCore.Cors (1)
Microsoft.AspNetCore.Cors.Test (22)
CorsServiceTests.cs (18)
573Assert.Empty(httpContext.Response.Headers);
593Assert.Equal("http://example.com", httpContext.Response.Headers["Access-Control-Allow-Origin"]);
613Assert.DoesNotContain("Access-Control-Allow-Origin", httpContext.Response.Headers.Keys);
633Assert.Equal("true", httpContext.Response.Headers["Access-Control-Allow-Credentials"]);
653Assert.Equal("Origin", httpContext.Response.Headers["Vary"]);
667httpContext.Response.Headers["Vary"] = "Cookie";
674Assert.Equal("Cookie,Origin", httpContext.Response.Headers["Vary"]);
694Assert.DoesNotContain("Access-Control-Allow-Credentials", httpContext.Response.Headers.Keys);
714Assert.DoesNotContain("Access-Control-Allow-Methods", httpContext.Response.Headers.Keys);
735Assert.Equal("PUT", httpContext.Response.Headers["Access-Control-Allow-Methods"]);
755Assert.DoesNotContain("Access-Control-Allow-Headers", httpContext.Response.Headers.Keys);
776Assert.Equal("foo", httpContext.Response.Headers["Access-Control-Allow-Headers"]);
796Assert.DoesNotContain("Access-Control-Expose-Headers", httpContext.Response.Headers.Keys);
817Assert.DoesNotContain("Access-Control-Expose-Headers", httpContext.Response.Headers.Keys);
838Assert.Equal("foo,bar", httpContext.Response.Headers[CorsConstants.AccessControlExposeHeaders]);
858Assert.Equal("foo", httpContext.Response.Headers["Access-Control-Expose-Headers"]);
879Assert.DoesNotContain("Access-Control-Max-Age", httpContext.Response.Headers.Keys);
899Assert.Equal("30", httpContext.Response.Headers["Access-Control-Max-Age"]);
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (4)
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
Microsoft.AspNetCore.Diagnostics.Middleware (5)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (8)
Microsoft.AspNetCore.Diagnostics.Tests (16)
ExceptionHandlerTest.cs (16)
216httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=600" });
217httpContext.Response.Headers.Add("Pragma", new[] { "max-age=600" });
218httpContext.Response.Headers.Add(
220httpContext.Response.Headers.Add("ETag", new[] { "12345" });
278httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
279httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
280httpContext.Response.Headers.Add("Expires", new[] { expiresTime });
281httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
350httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
351httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
352httpContext.Response.Headers.Add("Expires", new[] { DateTime.UtcNow.AddDays(10).ToString("R") });
353httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
418httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
419httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
420httpContext.Response.Headers.Add("Expires", new[] { expiresTime });
421httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Microsoft.AspNetCore.Hosting (3)
Microsoft.AspNetCore.Http.Connections (6)
Microsoft.AspNetCore.Http.Connections.Tests (6)
Microsoft.AspNetCore.Http.Extensions (3)
Microsoft.AspNetCore.Http.Extensions.Tests (5)
Microsoft.AspNetCore.Http.Results (12)
Microsoft.AspNetCore.Http.Results.Tests (115)
src\Shared\ResultsTests\FileContentResultTestBase.cs (24)
81Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
82Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
84Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
86Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
119Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
120Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
123Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
125Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
159Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
160Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
193Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
194Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
223Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
225Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
226Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
255Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
256Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
258Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
259Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
293Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
294Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
327Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
328Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
329Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
src\Shared\ResultsTests\FileStreamResultTestBase.cs (28)
60Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
61Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
63Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
64Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
100Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
101Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
104Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
105Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
142Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
143Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
179Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
180Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
211Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
213Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
214Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
245Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
246Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
248Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
249Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
285Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
286Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
321Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
322Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
323Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
360Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
361Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
364Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
365Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (22)
56Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
57Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
58Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
86Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
88Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
89Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
90Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
118Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
145Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
173Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
174Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
204Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
205Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
206Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
233Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
234Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
260Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
261Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
262Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
316Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
317Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
318Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (21)
68Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
69Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
70Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
104Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
106Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
107Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
141Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
174Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
208Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
209Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
246Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
247Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
248Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
279Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
280Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
310Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
311Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
312Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
351Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
352Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
353Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
Microsoft.AspNetCore.Http.Tests (8)
Microsoft.AspNetCore.HttpLogging (2)
Microsoft.AspNetCore.HttpLogging.Tests (20)
Microsoft.AspNetCore.HttpsPolicy (2)
Microsoft.AspNetCore.Identity.UI (2)
Microsoft.AspNetCore.Localization (1)
Microsoft.AspNetCore.Mvc.Core (15)
Microsoft.AspNetCore.Mvc.Core.Test (150)
Filters\ResponseCacheFilterExecutorTest.cs (12)
29Assert.Equal("no-store", context.HttpContext.Response.Headers["Cache-control"]);
188Assert.Equal(output, context.HttpContext.Response.Headers["Cache-control"]);
245Assert.Equal(output, context.HttpContext.Response.Headers["Cache-control"]);
325Assert.Equal(varyOutput, context.HttpContext.Response.Headers["Vary"]);
326Assert.Equal(cacheControlOutput, context.HttpContext.Response.Headers["Cache-control"]);
409Assert.Equal(cacheControlOutput, context.HttpContext.Response.Headers.CacheControl);
450Assert.Equal("no-store,no-cache", context.HttpContext.Response.Headers["Cache-control"]);
451Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
470Assert.Equal("public,max-age=20", context.HttpContext.Response.Headers["Cache-control"]);
490Assert.Equal("private,max-age=10", context.HttpContext.Response.Headers["Cache-control"]);
510Assert.Equal("public,max-age=10", context.HttpContext.Response.Headers["Cache-control"]);
530Assert.Equal("Test", context.HttpContext.Response.Headers["Vary"]);
src\Shared\ResultsTests\FileContentResultTestBase.cs (24)
81Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
82Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
84Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
86Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
119Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
120Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
123Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
125Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
159Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
160Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
193Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
194Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
223Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
225Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
226Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
255Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
256Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
258Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
259Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
293Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
294Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
327Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
328Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
329Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
src\Shared\ResultsTests\FileStreamResultTestBase.cs (28)
60Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
61Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
63Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
64Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
100Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
101Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
104Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
105Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
142Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
143Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
179Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
180Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
211Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
213Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
214Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
245Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
246Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
248Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
249Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
285Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
286Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
321Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
322Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
323Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
360Assert.Equal(lastModified.ToString("R"), httpResponse.Headers.LastModified);
361Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
364Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
365Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (22)
56Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
57Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
58Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
86Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
88Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
89Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
90Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
118Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
145Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
173Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
174Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
204Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
205Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
206Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
233Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
234Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
260Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
261Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
262Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
316Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
317Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
318Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (21)
68Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
69Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
70Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
104Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
106Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
107Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
141Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
174Assert.Equal(entityTag.ToString(), httpResponse.Headers.ETag);
208Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
209Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
246Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
247Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
248Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
279Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
280Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
310Assert.Equal(0, httpResponse.Headers.ContentRange.Count);
311Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
312Assert.False(httpResponse.Headers.ContainsKey(HeaderNames.ContentType));
351Assert.Equal("bytes", httpResponse.Headers.AcceptRanges);
352Assert.Equal(contentRange.ToString(), httpResponse.Headers.ContentRange);
353Assert.NotEqual(0, httpResponse.Headers.LastModified.Count);
Microsoft.AspNetCore.Mvc.Cors.Test (11)
CorsAuthorizationFilterTest.cs (11)
42Assert.Equal("http://example.com", response.Headers[CorsConstants.AccessControlAllowOrigin]);
43Assert.Equal("header1,header2", response.Headers[CorsConstants.AccessControlAllowHeaders]);
46Assert.Equal("PUT", response.Headers[CorsConstants.AccessControlAllowMethods]);
47Assert.Equal("exposed1,exposed2", response.Headers[CorsConstants.AccessControlExposeHeaders]);
48Assert.Equal("123", response.Headers[CorsConstants.AccessControlMaxAge]);
49Assert.Equal("true", response.Headers[CorsConstants.AccessControlAllowCredentials]);
70Assert.Empty(authorizationContext.HttpContext.Response.Headers);
92Assert.Equal("http://example.com", response.Headers[CorsConstants.AccessControlAllowOrigin]);
93Assert.Equal("exposed1,exposed2", response.Headers[CorsConstants.AccessControlExposeHeaders]);
113Assert.Empty(authorizationContext.HttpContext.Response.Headers);
195var headers = response1.Headers;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
Microsoft.AspNetCore.OutputCaching.Tests (35)
Microsoft.AspNetCore.Owin.Tests (2)
Microsoft.AspNetCore.ResponseCaching (12)
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (1)
Microsoft.AspNetCore.ResponseCaching.Tests (11)
Microsoft.AspNetCore.ResponseCompression (3)
Microsoft.AspNetCore.ResponseCompression.Tests (18)
Microsoft.AspNetCore.Rewrite (8)
Microsoft.AspNetCore.Rewrite.Tests (5)
Microsoft.AspNetCore.Routing (1)
Microsoft.AspNetCore.Routing.FunctionalTests (3)
Microsoft.AspNetCore.Routing.Tests (3)
Microsoft.AspNetCore.Security.Microbenchmarks (2)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (65)
ResponseCachingTests.cs (41)
52httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
71httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
72httpContext.Response.Headers["Cache-Control"] = "public";
92httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
93httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
113httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
114httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
138httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
139httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
158httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
159httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
178httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
179httpContext.Response.Headers["Cache-Control"] = "public, max-age=" + int.MaxValue.ToString(CultureInfo.InvariantCulture);
198httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
199httpContext.Response.Headers["Cache-Control"] = "public, s-maxage=10";
218httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
219httpContext.Response.Headers["Cache-Control"] = "public, max-age=0, s-maxage=10";
238httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
239httpContext.Response.Headers["Cache-Control"] = "public";
240httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r");
262httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
263httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
264httpContext.Response.Headers[headerName] = "headerValue";
285httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
286httpContext.Response.Headers["Cache-Control"] = "public";
287httpContext.Response.Headers["Expires"] = expiresValue;
306httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
307httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r");
326httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
327httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
328httpContext.Response.Headers["Expires"] = (DateTime.UtcNow - TimeSpan.FromSeconds(10)).ToString("r"); // In the past
347httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
348httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
368httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
369httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
390httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
391httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
409httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
410httpContext.Response.Headers["Cache-Control"] = "public, max-age=30";
429httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
430httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (11)
Microsoft.AspNetCore.Session (1)
Microsoft.AspNetCore.SpaProxy (1)
Microsoft.AspNetCore.SpaServices.Extensions (3)
Microsoft.AspNetCore.StaticAssets (8)
Microsoft.AspNetCore.StaticFiles (2)
Microsoft.AspNetCore.TestHost (1)
Microsoft.AspNetCore.TestHost.Tests (25)
Microsoft.AspNetCore.WebSockets (2)
Microsoft.AspNetCore.WebSockets.Tests (1)
OutputCachingSample (1)
QueueSharing (1)
RazorPagesWebSite (2)
ResponseCachingSample (1)
ServerComparison.TestSites (4)
SignalR.Client.FunctionalTestApp (4)
Sockets.FunctionalTests (5)
WebPubSubWeb (1)