1 override of Headers
Microsoft.AspNetCore.Http (1)
Internal\DefaultHttpResponse.cs (1)
62public override IHeaderDictionary Headers
1014 references to Headers
Aspire.Dashboard (5)
DashboardWebApplication.cs (2)
396if (context.Context.Response.Headers.CacheControl.Count == 0) 398context.Context.Response.Headers.CacheControl = "no-cache";
Model\BrowserSecurityHeadersMiddleware.cs (3)
69context.Response.Headers.ContentSecurityPolicy = context.Request.IsHttps 74context.Response.Headers["Referrer-Policy"] = "strict-origin-when-cross-origin"; 76context.Response.Headers.XContentTypeOptions = "nosniff";
Aspire.Dashboard.Tests (7)
BrowserSecurityHeadersMiddlewareTests.cs (7)
28Assert.NotEqual(StringValues.Empty, httpContext.Response.Headers.ContentSecurityPolicy); 29Assert.DoesNotContain("default-src", httpContext.Response.Headers.ContentSecurityPolicy.ToString()); 43Assert.NotEqual(StringValues.Empty, httpContext.Response.Headers.ContentSecurityPolicy); 44Assert.Contains("default-src", httpContext.Response.Headers.ContentSecurityPolicy.ToString()); 61Assert.NotEqual(StringValues.Empty, httpContext.Response.Headers.ContentSecurityPolicy); 62Assert.Contains(expectedContent, httpContext.Response.Headers.ContentSecurityPolicy.ToString()); 77Assert.Equal(StringValues.Empty, httpContext.Response.Headers.ContentSecurityPolicy);
BasicWebSite (3)
Controllers\HomeController.cs (1)
73Response.Headers.Add("Message", new[] { "Hello, World!" });
Controllers\TestingController.cs (1)
29Response.Headers.Add("X-Pass-Thru", passThruValue);
Filters\ServiceActionFilter.cs (1)
24context.HttpContext.Response.Headers["X-ServiceActionFilter"] = "True";
Binding.Http.IntegrationTests (1)
MtomBindingTestHelper.cs (1)
58context.Response.Headers.ContentType = "multipart/related; type=\"application/xop+xml\";start=\"<http://tempuri.org/0>\";boundary=\"uuid:fca834ef-6b4a-43c0-a7d0-09064d2827e8+id=1\";start-info=\"text/xml\"";
blazor-devserver (3)
Server\Startup.cs (3)
40ctx.Response.Headers.Append("Blazor-Environment", webHostEnvironment.EnvironmentName); 109httpContext.Response.Headers["Cross-Origin-Embedder-Policy"] = "require-corp"; 110httpContext.Response.Headers["Cross-Origin-Opener-Policy"] = "same-origin";
CookiePolicySample (1)
Startup.cs (1)
112var responseCookies = response.Headers.SetCookie;
FormatterWebSite (1)
Controllers\SystemTextJsonOutputFormatterController.cs (1)
26HttpContext.Response.Headers["Test"] = "t";
GenericHostWebSite (1)
Controllers\TestingController.cs (1)
28Response.Headers.Add("X-Pass-Thru", passThruValue);
Http3SampleApp (1)
Startup.cs (1)
24context.Response.Headers["test"] = "foo";
HttpLogging.Sample (1)
SampleHttpLoggingInterceptor.cs (1)
49foreach (var header in logContext.HttpContext.Response.Headers)
HttpStress (2)
Program.cs (2)
441context.Response.Headers.Add( 495context.Response.Headers.ContentLength = maxContentLength;
InMemory.FunctionalTests (137)
ChunkedRequestTests.cs (10)
66response.Headers["Content-Length"] = bytes.Length.ToString(CultureInfo.InvariantCulture); 182response.Headers["Content-Length"] = new[] { "11" }; 295response.Headers["Content-Length"] = new[] { "11" }; 426response.Headers["Content-Length"] = new[] { "11" }; 601response.Headers["Content-Length"] = new[] { "11" }; 674response.Headers["Content-Length"] = new[] { "11" }; 718response.Headers["Content-Length"] = new[] { "11" }; 929response.Headers["Content-Length"] = new[] { "11" }; 981response.Headers["Content-Length"] = new[] { "11" }; 1092response.Headers["Content-Length"] = new[] { "11" };
ChunkedResponseTests.cs (2)
280httpContext.Response.Headers["Connection"] = "close"; 538response.Headers["Transfer-Encoding"] = "chunked";
Http2\Http2ConnectionTests.cs (4)
2370c.Response.Headers.SetCookie = "SetCookie!"; 2371c.Response.Headers.ContentDisposition = "ContentDisposition!"; 3890context.Response.Headers["A"] = new string('a', headerValueLength); 3891context.Response.Headers["B"] = new string('b', headerValueLength);
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");
Http2\Http2TestBase.cs (5)
284context.Response.Headers[name] = _4kHeaderValue; 356context.Response.Headers["Method"] = context.Request.Method; 364context.Response.Headers.Host = context.Request.Headers.Host; 372context.Response.Headers["path"] = context.Request.Path.ToString(); 373context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
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;
Http3\Http3TestBase.cs (4)
96context.Response.Headers["Method"] = context.Request.Method; 103context.Response.Headers["path"] = context.Request.Path.ToString(); 104context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget; 111context.Response.Headers.Host = context.Request.Headers.Host;
RequestTargetProcessingTests.cs (2)
26context.Response.Headers.ContentLength = 11; 71context.Response.Headers["Content-Length"] = new[] { "11" };
RequestTests.cs (5)
1408if (context.Response.Headers != lastResponseHeaders) 1410lastResponseHeaders = context.Response.Headers; 1921response.Headers["Content-Length"] = new[] { "11" }; 1967response.Headers["Content-Length"] = new[] { "11" }; 2050response.Headers["Content-Length"] = new[] { "11" };
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"));
ResponseTests.cs (18)
680httpContext.Response.Headers.ContentLength = 1; 718httpContext.Response.Headers.ContentLength = 0; 758httpContext.Response.Headers.ContentLength = 1; 1346httpContext.Response.Headers["Transfer-Encoding"] = "chunked"; 1382httpContext.Response.Headers["Transfer-Encoding"] = "chunked"; 1579httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; 1624httpContext.Response.Headers["Connection"] = "keep-alive"; 1625httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; 1670httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding; 2434response.Headers["Content-Length"] = "11"; 2549response.Headers["Content-Length"] = new[] { "11" }; 2595response.Headers["Content-Length"] = new[] { "11" }; 2642response.Headers["Content-Length"] = new[] { "11" }; 2689response.Headers["Content-Length"] = new[] { "11" }; 2734response.Headers["Content-Length"] = new[] { "11" }; 2769response.Headers["Content-Length"] = new[] { "11" }; 3178httpContext.Response.Headers["Content-Length"] = new[] { "11" }; 4371httpContext.Response.Headers.AltSvc = "Custom";
src\Servers\Kestrel\shared\test\TestApp.cs (2)
35response.Headers.ContentLength = bytes.Length; 69response.Headers.ContentLength = bytes.Length;
InProcessWebSite (10)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (8)
194context.Response.Headers["connection"] = "close"; 200context.Response.Headers["Server"] = "MyServer/7.8"; 340Assert.NotNull(ctx.Response.Headers); 449ctx.Response.Headers["UnknownHeader"] = "test123=foo"; 451ctx.Response.Headers["MultiHeader"] = new StringValues(new string[] { "1", "2" }); 457ctx.Response.Headers["EmptyHeader"] = ""; 539ctx.Response.Headers["This will fail"] = "some value"; 730ctx.Response.Headers["BodyAsString"] = value;
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (2)
82context.Response.Headers["custom-header"] = "value"; 151context.Response.Headers[headerPair.Key] = headerPair.Value;
Interop.FunctionalTests (4)
Http2\Http2RequestTests.cs (2)
170c.Response.Headers["test"] = "abc"; 171c.Response.Headers[longKey] = longValue;
HttpClientHttp2InteropTests.cs (2)
1092context.Response.Headers.Append("header" + i, oneKbString + i); 1391context.Response.Headers.Append("header" + i, oneKbString + i);
JwtBearerSample (1)
Startup.cs (1)
87response.Headers.CacheControl = "no-cache";
LocalizationWebsite (2)
StartupContentLanguageHeader.cs (2)
36var hasContentLanguageHeader = context.Response.Headers.ContainsKey(HeaderNames.ContentLanguage); 37var contentLanguage = context.Response.Headers.ContentLanguage.ToString();
Microsoft.AspNetCore.Antiforgery (5)
Internal\DefaultAntiforgery.cs (5)
247if (!_options.SuppressXFrameOptionsHeader && !httpContext.Response.Headers.ContainsKey(HeaderNames.XFrameOptions)) 252httpContext.Response.Headers.XFrameOptions = "SAMEORIGIN"; 364var responseHeaders = httpContext.Response.Headers; 387httpContext.Response.Headers.Pragma = "no-cache"; 392httpContext.Response.Headers.Pragma = "no-cache";
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)
CookieAuthenticationEvents.cs (4)
46context.Response.Headers.Location = context.RedirectUri; 63context.Response.Headers.Location = context.RedirectUri; 80context.Response.Headers.Location = context.RedirectUri; 96context.Response.Headers.Location = context.RedirectUri;
CookieAuthenticationHandler.cs (3)
418Response.Headers.CacheControl = HeaderValueNoCacheNoStore; 419Response.Headers.Pragma = HeaderValueNoCache; 420Response.Headers.Expires = HeaderValueEpocDate;
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
274var responseHeaders = context.Response.Headers;
Microsoft.AspNetCore.Authentication.JwtBearer (2)
JwtBearerHandler.cs (2)
302Response.Headers.Append(HeaderNames.WWWAuthenticate, Options.Challenge); 344Response.Headers.Append(HeaderNames.WWWAuthenticate, builder.ToString());
Microsoft.AspNetCore.Authentication.Negotiate (3)
NegotiateHandler.cs (3)
183Response.Headers.Append(HeaderNames.WWWAuthenticate, AuthHeaderPrefix + outgoing); 197Response.Headers.Append(HeaderNames.WWWAuthenticate, AuthHeaderPrefix + outgoing); 395Response.Headers.Append(HeaderNames.WWWAuthenticate, NegotiateVerb);
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)
OAuthHandler.cs (2)
279var location = Context.Response.Headers.Location; 285var cookie = Context.Response.Headers.SetCookie;
Microsoft.AspNetCore.Authentication.OpenIdConnect (8)
OpenIdConnectHandler.cs (8)
294Response.Headers.CacheControl = "no-cache, no-store"; 295Response.Headers.Pragma = "no-cache"; 296Response.Headers.Expires = HeaderValueEpocDate; 365var location = Context.Response.Headers.Location; 371var cookie = Context.Response.Headers.SetCookie; 542Response.Headers.CacheControl = "no-cache, no-store"; 543Response.Headers.Pragma = "no-cache"; 544Response.Headers.Expires = HeaderValueEpocDate;
Microsoft.AspNetCore.Authentication.Test (3)
OpenIdConnect\OpenIdConnectChallengeTests.cs (1)
377context.Response.Headers.Add("tea", "Oolong");
WsFederation\WsFederationTest.cs (1)
352context.Response.Headers["EventHeader"] = "OnRemoteSignOut";
WsFederation\WsFederationTest_Handler.cs (1)
348context.Response.Headers["EventHeader"] = "OnRemoteSignOut";
Microsoft.AspNetCore.Components.Endpoints (11)
Builder\ResourceCollectionUrlEndpoint.cs (6)
214context.Response.Headers[HeaderNames.ContentEncoding] = "gzip"; 215context.Response.Headers[HeaderNames.Vary] = HeaderNames.AcceptEncoding; 216context.Response.Headers.ETag = new StringValues(_gzipContentETags); 221context.Response.Headers.ETag = new StringValues(_contentETag); 226context.Response.Headers[HeaderNames.CacheControl] = "max-age=31536000, immutable"; 231context.Response.Headers[HeaderNames.CacheControl] = "no-cache, must-revalidate";
RazorComponentEndpointInvoker.cs (1)
129context.Response.Headers.ContentEncoding = "identity";
Rendering\EndpointHtmlRenderer.Prerendering.cs (2)
82context.Response.Headers.Add("blazor-enhanced-nav", "allow"); 216httpContext.Response.Headers.Add("blazor-enhanced-nav-redirect-location",
Rendering\EndpointHtmlRenderer.Streaming.cs (2)
32httpContext.Response.Headers.Add(_streamingRenderingFramingHeaderName, id); 271_httpContext.Response.Headers.CacheControl = "no-cache, no-store, max-age=0";
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
EndpointHtmlRendererTest.cs (3)
323Assert.Equal("no-cache, no-store, max-age=0", httpContext.Response.Headers.CacheControl); 367Assert.Equal("no-cache, no-store, max-age=0", httpContext.Response.Headers.CacheControl); 808Assert.Equal("http://localhost/redirect", ctx.Response.Headers.Location);
RazorComponentResultTest.cs (1)
233Assert.Equal("https://test/somewhere/else", httpContext.Response.Headers.Location);
Microsoft.AspNetCore.Components.Server (1)
Builder\ServerRazorComponentsEndpointConventionBuilderExtensions.cs (1)
58var headers = context.Response.Headers;
Microsoft.AspNetCore.Components.WebAssembly.Server (8)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (2)
44httpContext.Response.Headers["Cross-Origin-Embedder-Policy"] = "require-corp"; 45httpContext.Response.Headers["Cross-Origin-Opener-Policy"] = "same-origin";
ComponentsWebAssemblyApplicationBuilderExtensions.cs (4)
48context.Response.Headers.Append("Blazor-Environment", webHostEnvironment.EnvironmentName); 55context.Response.Headers.Append("DOTNET-MODIFIABLE-ASSEMBLIES", s_dotnetModifiableAssemblies); 62context.Response.Headers.Append("ASPNETCORE-BROWSER-TOOLS", s_aspnetcoreBrowserTools); 107fileContext.Context.Response.Headers.Append(HeaderNames.CacheControl, "no-cache");
ContentEncodingNegotiator.cs (2)
91context.Response.Headers.ContentEncoding = selectedEncoding.Value; 92context.Response.Headers.Append(HeaderNames.Vary, HeaderNames.ContentEncoding);
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)
CookieChunkingTests.cs (12)
18var values = context.Response.Headers["Set-Cookie"]; 41var values = context.Response.Headers["Set-Cookie"]; 53var values = context.Response.Headers["Set-Cookie"]; 72var values = context.Response.Headers["Set-Cookie"]; 100var values = context.Response.Headers["Set-Cookie"]; 131var values = context.Response.Headers["Set-Cookie"]; 214var cookies = context.Response.Headers["Set-Cookie"]; 236var cookies = context.Response.Headers["Set-Cookie"]; 254var cookies = context.Response.Headers["Set-Cookie"]; 290httpContext.Response.Headers[HeaderNames.SetCookie] = new[] 303Assert.Equal(8, httpContext.Response.Headers[HeaderNames.SetCookie].Count); 314}, httpContext.Response.Headers[HeaderNames.SetCookie].ToArray());
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"]);
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
274var responseHeaders = context.Response.Headers;
Microsoft.AspNetCore.Cors (1)
Infrastructure\CorsService.cs (1)
164var headers = response.Headers;
Microsoft.AspNetCore.Cors.Test (22)
CorsMiddlewareTests.cs (4)
428Assert.Empty(httpContext.Response.Headers); 525context.Response.Headers.Add("Test", "Should-Appear"); 601context.Response.Headers.Add("Test", "Should-Not-Exist"); 668response.Headers.OrderBy(o => o.Key),
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)
ExceptionHandler\ExceptionHandlerMiddlewareImpl.cs (1)
255var headers = ((HttpResponse)state).Headers;
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (4)
MigrationsEndPointMiddleware.cs (4)
79context.Response.Headers.Add("Pragma", new[] { "no-cache" }); 80context.Response.Headers.Add("Cache-Control", new[] { "no-cache,no-store" }); 134response.Headers.Add("Pragma", new[] { "no-cache" }); 135response.Headers.Add("Cache-Control", new[] { "no-cache,no-store" });
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
HealthCheckMiddleware.cs (1)
64var headers = httpContext.Response.Headers;
Microsoft.AspNetCore.Diagnostics.Middleware (5)
Latency\AddServerTimingHeaderMiddleware.cs (3)
42if (httpContext.Response.Headers.TryGetValue(ServerTimingHeaderName, out var existing)) 44httpContext.Response.Headers[ServerTimingHeaderName] = $"{existing}, reqlatency;dur={elapsedMs}"; 48httpContext.Response.Headers.Append(ServerTimingHeaderName, $"reqlatency;dur={elapsedMs}");
Latency\RequestLatencyTelemetryMiddleware.cs (1)
68httpContext.Response.Headers[TelemetryConstants.ServerApplicationNameHeader] = _applicationName;
Logging\HttpLoggingRedactionInterceptor.cs (1)
141_responseHeadersReader.Read(context.Response.Headers, logContext.Parameters);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (8)
Latency\AddServerTimingHeaderMiddlewareTests.cs (1)
45var header = context.Response.Headers[AddServerTimingHeaderMiddleware.ServerTimingHeaderName];
Latency\ChecpointAcceptanceTests.cs (1)
92ctx.Response.Headers.Append("Server-Timing", alreadySetServerTimingHeader);
Latency\RequestLatencyTelemetryMiddlewareTests.cs (5)
44var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader]; 74Assert.False(httpContextMock.Response.Headers.TryGetValue(TelemetryConstants.ServerApplicationNameHeader, out var val)); 98httpContextMock.Response.Headers.Append(TelemetryConstants.ServerApplicationNameHeader, "testValue"); 102var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader]; 133Assert.False(httpContextMock.Response.Headers.TryGetValue(TelemetryConstants.ServerApplicationNameHeader, out var val));
Logging\AcceptanceTests.cs (1)
90context.Response.Headers.Append(HeaderNames.TransferEncoding, "chunked");
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)
Internal\JsonTranscodingServerCallContext.cs (2)
220HttpContext.Response.Headers[entry.Key] = Convert.ToBase64String(entry.ValueBytes); 224HttpContext.Response.Headers[entry.Key] = entry.Value;
Microsoft.AspNetCore.Hosting (3)
Internal\ErrorPageBuilder.cs (2)
31context.Response.Headers.CacheControl = "no-cache,no-store"; 32context.Response.Headers.Pragma = "no-cache";
Internal\HostingApplicationDiagnostics.cs (1)
468[DynamicDependency(nameof(HttpResponse.Headers), typeof(HttpResponse))]
Microsoft.AspNetCore.Http.Connections (6)
Internal\HttpConnectionDispatcher.cs (3)
829response.Headers.CacheControl = HeaderValueNoCacheNoStore; 830response.Headers.Pragma = HeaderValueNoCache; 831response.Headers.Expires = HeaderValueEpochDate;
Internal\Transports\ServerSentEventsServerTransport.cs (3)
34context.Response.Headers.CacheControl = "no-cache,no-store"; 35context.Response.Headers.Pragma = "no-cache"; 41context.Response.Headers.ContentEncoding = "identity";
Microsoft.AspNetCore.Http.Connections.Tests (6)
HttpConnectionDispatcherTests.cs (4)
832Assert.NotNull(connectionHttpContext.Response.Headers); 3793Assert.Equal("no-cache, no-store", response.Headers.CacheControl); 3794Assert.Equal("no-cache", response.Headers.Pragma); 3795Assert.Equal("Thu, 01 Jan 1970 00:00:00 GMT", response.Headers.Expires);
ServerSentEventsTests.cs (2)
35Assert.Equal("no-cache,no-store", context.Response.Headers["Cache-Control"]); 36Assert.Equal("no-cache", context.Response.Headers["Pragma"]);
Microsoft.AspNetCore.Http.Extensions (3)
HeaderDictionaryTypeExtensions.cs (1)
37return new ResponseHeaders(response.Headers);
ResponseExtensions.cs (2)
28response.Headers.Clear(); 53response.Headers.Location = location;
Microsoft.AspNetCore.Http.Extensions.Tests (5)
HttpResponseJsonExtensionsTests.cs (2)
503httpContext.Response.Headers["Test"] = "t"; 535httpContext.Response.Headers["Test"] = "t";
ResponseExtensionTests.cs (3)
15context.Response.Headers["custom"] = "value"; 21Assert.Equal(string.Empty, context.Response.Headers["custom"].ToString()); 47Assert.Equal(location, context.Response.Headers.Location.First());
Microsoft.AspNetCore.Http.Results (12)
Accepted.cs (1)
69httpContext.Response.Headers.Location = Location;
AcceptedAtRoute.cs (1)
97httpContext.Response.Headers.Location = url;
AcceptedAtRouteOfT.cs (1)
111httpContext.Response.Headers.Location = url;
AcceptedOfT.cs (1)
81httpContext.Response.Headers.Location = Location;
Created.cs (1)
69httpContext.Response.Headers.Location = Location;
CreatedAtRoute.cs (1)
97httpContext.Response.Headers.Location = url;
CreatedAtRouteOfT.cs (1)
111httpContext.Response.Headers.Location = url;
CreatedOfT.cs (1)
80httpContext.Response.Headers.Location = Location;
RedirectHttpResult.cs (1)
114httpContext.Response.Headers.Location = destinationUrl;
RedirectToRouteHttpResult.cs (1)
183httpContext.Response.Headers.Location = destinationUrl;
src\Shared\ResultsHelpers\FileResultHelper.cs (2)
354httpContext.Response.Headers.ContentDisposition = contentDisposition.ToString(); 373response.Headers.AcceptRanges = AcceptRangeHeaderValue;
Microsoft.AspNetCore.Http.Results.Tests (115)
AcceptedAtRouteOfTResultTests.cs (1)
99Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedAtRouteResultTests.cs (1)
53Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedOfTResultTests.cs (1)
45Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedResultTests.cs (1)
29Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
CreatedAtRouteOfTResultTests.cs (1)
69Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
CreatedAtRouteResultTests.cs (1)
52Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
CreatedOfTResultTests.cs (4)
58Assert.Equal(location, httpContext.Response.Headers["Location"]); 67httpContext.Response.Headers["Location"] = "/different/location/"; 75Assert.Equal(location, httpContext.Response.Headers["Location"]); 86httpContext.Response.Headers["Location"] = "/different/location/";
CreatedResultTests.cs (3)
43Assert.Equal(location, httpContext.Response.Headers["Location"]); 52httpContext.Response.Headers["Location"] = "/different/location/"; 60Assert.Equal(location, httpContext.Response.Headers["Location"]);
LocalRedirectResultTests.cs (1)
72Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString());
RedirectToRouteResultTests.cs (4)
47Assert.True(httpContext.Response.Headers.ContainsKey("Location"), "Location header not found"); 48Assert.Equal(locationUrl, httpContext.Response.Headers["Location"]); 66Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 84Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
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\RedirectResultTestBase.cs (2)
34Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString()); 57Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString());
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)
Timeouts\RequestTimeoutsMiddlewareTests.cs (8)
192context.Response.Headers.Add("ToBeCleared", "Later"); 198Assert.Empty(context.Response.Headers); 208context.Response.Headers.Add("ToBeCleared", "Later"); 214Assert.Empty(context.Response.Headers); 225context.Response.Headers.Add("ToBeCleared", "Later"); 234Assert.Empty(context.Response.Headers); 245context.Response.Headers.Add("NotGonnaBeCleared", "Not Today!"); 251Assert.NotEmpty(context.Response.Headers);
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingFields.cs (1)
96/// Flag for logging the HTTP Response <see cref="HttpResponse.Headers"/>.
HttpLoggingMiddleware.cs (1)
340FilterHeaders(logContext, response.Headers, options._internalResponseHeaders);
Microsoft.AspNetCore.HttpLogging.Tests (20)
HttpLoggingMiddlewareTests.cs (20)
820c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 843c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 867c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 889c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 913c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 939c.Response.Headers["Server"] = "Kestrel"; 963c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 986c.Response.Headers["Test"] = "Kestrel"; 1008c.Response.Headers["Test"] = "Kestrel"; 1009c.Response.Headers["Server"] = "Kestrel"; 1097c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 1135c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 1212httpContext.Response.Headers[HeaderNames.Connection] = HeaderNames.Upgrade; 1262httpContext.Response.Headers.Connection = HeaderNames.Upgrade; 1316httpContext.Response.Headers[HeaderNames.Connection] = HeaderNames.Upgrade; 1359httpContext.Response.Headers[HeaderNames.Connection] = HeaderNames.Upgrade; 1403c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 1437httpContext.Response.Headers[HeaderNames.Connection] = HeaderNames.Upgrade; 1511c.Response.Headers[HeaderNames.TransferEncoding] = "test"; 1580c.Response.Headers[HeaderNames.TransferEncoding] = "test";
Microsoft.AspNetCore.HttpsPolicy (2)
HstsMiddleware.cs (1)
76context.Response.Headers.StrictTransportSecurity = _strictTransportSecurityValue;
HttpsRedirectionMiddleware.cs (1)
110context.Response.Headers.Location = redirectUrl;
Microsoft.AspNetCore.Identity.UI (2)
Areas\Identity\Pages\V4\Account\Manage\DownloadPersonalData.cshtml.cs (1)
77Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
Areas\Identity\Pages\V5\Account\Manage\DownloadPersonalData.cshtml.cs (1)
77Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
Microsoft.AspNetCore.Localization (1)
RequestLocalizationMiddleware.cs (1)
116var headers = context.Response.Headers;
Microsoft.AspNetCore.Mvc.Core (15)
AcceptedAtActionResult.cs (1)
90context.HttpContext.Response.Headers.Location = url;
AcceptedAtRouteResult.cs (1)
86context.HttpContext.Response.Headers.Location = url;
AcceptedResult.cs (1)
77context.HttpContext.Response.Headers.Location = Location;
CreatedAtActionResult.cs (1)
90context.HttpContext.Response.Headers.Location = url;
CreatedAtRouteResult.cs (1)
86context.HttpContext.Response.Headers.Location = url;
CreatedResult.cs (1)
85context.HttpContext.Response.Headers.Location = Location;
Filters\ResponseCacheFilterExecutor.cs (1)
69var headers = context.HttpContext.Response.Headers;
Infrastructure\LocalRedirectResultExecutor.cs (1)
56context.HttpContext.Response.Headers.Location = destinationUrl;
Infrastructure\RedirectResultExecutor.cs (1)
53context.HttpContext.Response.Headers.Location = destinationUrl;
Infrastructure\RedirectToActionResultExecutor.cs (1)
59context.HttpContext.Response.Headers.Location = destinationUrl;
Infrastructure\RedirectToPageResultExecutor.cs (1)
59context.HttpContext.Response.Headers.Location = destinationUrl;
Infrastructure\RedirectToRouteResultExecutor.cs (1)
55context.HttpContext.Response.Headers.Location = destinationUrl;
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
274var responseHeaders = context.Response.Headers;
src\Shared\ResultsHelpers\FileResultHelper.cs (2)
354httpContext.Response.Headers.ContentDisposition = contentDisposition.ToString(); 373response.Headers.AcceptRanges = AcceptRangeHeaderValue;
Microsoft.AspNetCore.Mvc.Core.Test (150)
AcceptedAtActionResultTests.cs (2)
168Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 209var header = context.HttpContext.Response.Headers.Last();
AcceptedAtRouteResultTests.cs (1)
119Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedResultTests.cs (3)
81Assert.Equal(location, httpContext.Response.Headers["Location"]); 92httpContext.Response.Headers["Location"] = "/different/location/"; 100Assert.Equal(location, httpContext.Response.Headers["Location"]);
CreatedAtActionResultTests.cs (1)
41Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
CreatedAtRouteResultTests.cs (1)
55Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
CreatedResultTests.cs (4)
75Assert.Equal(location, httpContext.Response.Headers["Location"]); 91Assert.Equal(0, httpContext.Response.Headers["Location"].Count); 101httpContext.Response.Headers["Location"] = "/different/location/"; 109Assert.Equal(location, httpContext.Response.Headers["Location"]);
FileResultHelperTest.cs (6)
48Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]); 49Assert.Equal(@"attachment; filename=""some\\file""; filename*=UTF-8''some%5Cfile", httpContext.Response.Headers["Content-Disposition"]); 69Assert.Equal("application/my-type", httpContext.Response.Headers["Content-Type"]); 71httpContext.Response.Headers["Content-Disposition"]); 117Assert.Equal("attachment; filename=filename.ext; filename*=UTF-8''filename.ext", httpContext.Response.Headers["Content-Disposition"]); 234Assert.Equal("bytes", httpContext.Response.Headers.AcceptRanges);
Filters\MiddlewareFilterTest.cs (9)
55httpContext.Response.Headers.Add(expectedHeader, ""); 77Assert.True(resourceExecutedContext.HttpContext.Response.Headers.ContainsKey(expectedHeader)); 93httpContext.Response.Headers["h1"] = "pipeline1"; 101httpContext.Response.Headers["h1"] = httpContext.Response.Headers["h1"] + "-pipeline2"; 126Assert.True(response.Headers.ContainsKey(expectedHeader)); 127Assert.Equal(expectedHeaderValue, response.Headers[expectedHeader]); 180httpContext.Response.Headers.Add("Error", "Error!!!!"); 213Assert.True(response.Headers.ContainsKey("Error"));
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"]);
Infrastructure\ObjectResultExecutorTest.cs (3)
301actionContext.HttpContext.Response.Headers.ContentType); 395Assert.Equal(expectedContentType, actionContext.HttpContext.Response.Headers.ContentType); 432var responseContentType = actionContext.HttpContext.Response.Headers.ContentType;
LocalRedirectResultTest.cs (1)
78Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString());
RedirectToActionResultTest.cs (2)
108Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 136Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
RedirectToRouteResultTest.cs (4)
111Assert.True(httpContext.Response.Headers.ContainsKey("Location"), "Location header not found"); 112Assert.Equal(locationUrl, httpContext.Response.Headers["Location"]); 137Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 162Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
ResponseCacheAttributeTest.cs (4)
221Assert.True(response.Headers.TryGetValue("Cache-Control", out values)); 224Assert.True(response.Headers.TryGetValue("Vary", out values)); 277Assert.True(context.HttpContext.Response.Headers.TryGetValue("Cache-Control", out values)); 296Assert.True(context.HttpContext.Response.Headers.TryGetValue("Cache-Control", out values));
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\RedirectResultTestBase.cs (2)
34Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString()); 57Assert.Equal(expectedPath, httpContext.Response.Headers.Location.ToString());
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)
CookieTempDataProviderTest.cs (1)
90var setCookieHeader = SetCookieHeaderValue.Parse(context.Response.Headers["Set-Cookie"].ToString());
Microsoft.AspNetCore.OutputCaching.Tests (35)
OutputCacheMiddlewareTests.cs (14)
106context.HttpContext.Response.Headers["MyHeader"] = "OldValue"; 119Assert.Equal("NewValue", context.HttpContext.Response.Headers["MyHeader"]); 433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 456context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 482context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 522context.HttpContext.Response.Headers.Vary = vary; 543Assert.True(StringValues.IsNullOrEmpty(context.HttpContext.Response.Headers.Date)); 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); 595context.HttpContext.Response.Headers.Vary = "HeaderB, heaDera";
OutputCachePolicyProviderTests.cs (12)
145context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 163context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 181context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 199context.HttpContext.Response.Headers.SetCookie = "cookieName=cookieValue"; 213context.HttpContext.Response.Headers.Vary = "*"; 227context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 339context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 357context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 361context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(utcNow); 362context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow); 380context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue() 385context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow);
OutputCacheTests.cs (9)
307var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.Vary = HeaderNames.From); 606var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.SetCookie = "cookieName=cookieValue"); 674var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString); 698context.Response.Headers.ContentLocation = "/"; 699context.Response.Headers.Vary = HeaderNames.From; 747context.Response.Headers.ContentLocation = "/"; 748context.Response.Headers.Vary = HeaderNames.From; 865var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.Vary = HeaderNames.From); 889var builders = TestUtils.CreateBuildersWithOutputCaching(contextAction: context => context.Response.Headers.Vary = context.Request.Headers.Pragma);
Microsoft.AspNetCore.Owin.Tests (2)
OwinEnvironmentTests.cs (2)
32context.Response.Headers["CustomResponseHeader"] = "CustomResponseValue"; 94Assert.Equal("CustomResponseValue", context.Response.Headers["CustomResponseHeader"]);
Microsoft.AspNetCore.ResponseCaching (12)
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 (5)
163context.HttpContext.Response.Headers[key] = values; 175response.Headers[header.Key] = header.Value; 181response.Headers.Age = HeaderUtilities.FormatNonNegativeInt64(context.CachedEntryAge.Value.Ticks / TimeSpan.TicksPerSecond); 255var headers = response.Headers; 347if (!response.ContentLength.HasValue && StringValues.IsNullOrEmpty(response.Headers.TransferEncoding))
ResponseCachingPolicyProvider.cs (3)
68var responseCacheControlHeader = context.HttpContext.Response.Headers.CacheControl; 94if (!StringValues.IsNullOrEmpty(response.Headers.SetCookie)) 101var varyHeader = response.Headers.Vary;
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (1)
ResponseCachingBenchmark.cs (1)
36context.Response.Headers.CacheControl = _cacheControl;
Microsoft.AspNetCore.ResponseCaching.Tests (11)
ResponseCachingTests.cs (11)
269var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.Vary = HeaderNames.From); 292var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.Vary = HeaderNames.From); 545var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.SetCookie = "cookieName=cookieValue"); 619var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString); 644context.Response.Headers.ContentLocation = "/"; 645context.Response.Headers.Vary = HeaderNames.From; 697context.Response.Headers.ContentLocation = "/"; 698context.Response.Headers.Vary = HeaderNames.From; 822var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.Vary = HeaderNames.From); 848var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.Vary = context.Request.Headers.Pragma); 883var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Response.Headers.Vary = context.Request.Headers.Pragma);
Microsoft.AspNetCore.ResponseCompression (3)
ResponseCompressionBody.cs (1)
206var headers = _context.Response.Headers;
ResponseCompressionProvider.cs (2)
176if (context.Response.Headers.ContainsKey(HeaderNames.ContentRange)) 182if (context.Response.Headers.ContainsKey(HeaderNames.ContentEncoding))
Microsoft.AspNetCore.ResponseCompression.Tests (18)
ResponseCompressionBodyTest.cs (2)
20httpContext.Response.Headers.Vary = providedVaryHeader; 25Assert.Equal(expectedVaryHeader, httpContext.Response.Headers.Vary);
ResponseCompressionMiddlewareTest.cs (16)
165context.Response.Headers.ContentMD5 = "MD5"; 323context.Response.Headers.ContentMD5 = "MD5"; 405r.Headers.ContentRange = "1-2/*"; 421r.Headers.ContentEncoding = otherContentEncoding; 638context.Response.Headers.ContentMD5 = "MD5"; 684context.Response.Headers.ContentMD5 = "MD5"; 735context.Response.Headers.ContentMD5 = "MD5"; 788context.Response.Headers.ContentMD5 = "MD5"; 848context.Response.Headers.ContentMD5 = "MD5"; 918context.Response.Headers.ContentMD5 = "MD5"; 982context.Response.Headers.ContentMD5 = "MD5"; 1047context.Response.Headers.ContentMD5 = "MD5"; 1097context.Response.Headers.ContentMD5 = "MD5"; 1147context.Response.Headers.ContentMD5 = "MD5"; 1197context.Response.Headers.ContentMD5 = "MD5"; 1258context.Response.Headers.ContentMD5 = "MD5";
Microsoft.AspNetCore.Rewrite (8)
RedirectRule.cs (1)
100response.Headers.Location = encodedPath;
RedirectToHttpsRule.cs (1)
36response.Headers.Location = newUrl;
RedirectToWwwHelper.cs (1)
55response.Headers.Location = newUrl;
RewriteMiddleware.cs (1)
104httpContext.Response.Headers.Location.ToString(),
UrlActions\RedirectAction.cs (4)
42response.Headers.Location = pathBase.HasValue ? pathBase.Value : "/"; 64response.Headers.Location = pathBase + pattern.Substring(0, split) + query; 72response.Headers.Location = pathBase + pattern; 76response.Headers.Location = pathBase + pattern + context.HttpContext.Request.QueryString;
Microsoft.AspNetCore.Rewrite.Tests (5)
IISUrlRewrite\MiddleWareTests.cs (2)
37app.Run(context => context.Response.WriteAsync(context.Response.Headers.Location)); 137app.Run(context => context.Response.WriteAsync(context.Response.Headers.Location));
UrlActions\ChangeCookieActionTests.cs (3)
29var cookieHeaders = context.HttpContext.Response.Headers.SetCookie; 45var cookieHeaders = context.HttpContext.Response.Headers.SetCookie; 58var cookieHeaders = context.HttpContext.Response.Headers.SetCookie;
Microsoft.AspNetCore.Routing (1)
Matching\HttpMethodMatcherPolicy.cs (1)
388context.Response.Headers.Allow = allow;
Microsoft.AspNetCore.Routing.FunctionalTests (3)
ShortCircuitTests.cs (3)
27context.Response.Headers["NotSet"] = "No!"; 34context.Response.Headers["Set"] = "Yes!"; 70context.Response.Headers["NotSet"] = "No!";
Microsoft.AspNetCore.Routing.Tests (3)
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (3)
204Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]); 314Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]); 319Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]);
Microsoft.AspNetCore.Security.Microbenchmarks (2)
ChunkingCookieManagerBenchmark.cs (2)
55_httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty; 62_httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty;
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (65)
Http2Tests.cs (3)
324httpContext.Response.Headers.Connection = "close"; 368httpContext.Response.Headers.Connection = "close"; 446httpContext.Response.Headers.Connection = "close";
Http3Tests.cs (2)
58httpContext.Response.Headers.AltSvc = altsvc; 98httpContext.Response.Headers.AltSvc = altsvc;
OpaqueUpgradeTests.cs (4)
112httpContext.Response.Headers["Upgrade"] = "websocket"; // Win8.1 blocks anything but WebSockets 139httpContext.Response.Headers["Upgrade"] = "websocket"; // Win8.1 blocks anything but WebSockets 172httpContext.Response.Headers["Upgrade"] = "websocket"; // Win8.1 blocks anything but WebSockets 219httpContext.Response.Headers["Upgrade"] = "websocket"; // Win8.1 blocks anything but WebSockets
ResponseBodyTests.cs (8)
27Assert.True(httpContext.Response.Headers.IsReadOnly); 56Assert.True(httpContext.Response.Headers.IsReadOnly); 192httpContext.Response.Headers["transfeR-Encoding"] = "CHunked"; 215httpContext.Response.Headers["Content-lenGth"] = " 30 "; 239httpContext.Response.Headers["Content-lenGth"] = " 20 "; 253httpContext.Response.Headers["Content-lenGth"] = " 20 "; 268httpContext.Response.Headers["Content-lenGth"] = " 10 "; 289httpContext.Response.Headers["Content-lenGth"] = " 10 ";
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";
ResponseHeaderTests.cs (4)
191var responseHeaders = response.Headers; 221var responseHeaders = response.Headers; 252var responseHeaders = response.Headers; 281var responseHeaders = httpContext.Response.Headers;
ResponseSendFileTests.cs (3)
221httpContext.Response.Headers["Content-lenGth"] = FileLength.ToString(CultureInfo.InvariantCulture); 242httpContext.Response.Headers["Content-lenGth"] = "10"; 263httpContext.Response.Headers["Content-lenGth"] = "0";
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
src\Servers\Kestrel\shared\test\TestApp.cs (2)
35response.Headers.ContentLength = bytes.Length; 69response.Headers.ContentLength = bytes.Length;
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (11)
HeaderCollectionBenchmark.cs (7)
110_response.Headers[HeaderNames.ContentLength] = "0"; 152var headers = _response.Headers; 192var headers = _response.Headers; 227value = _response.Headers[HeaderNames.ContentLength]; 246var headers = _response.Headers; 268var headers = _response.Headers; 306var headers = _response.Headers;
Http2\Http2ConnectionHeadersBenchmark.cs (1)
38httpContext.Response.Headers[headerName] = "The quick brown fox jumps over the lazy dog.";
ResponseHeaderCollectionBenchmark.cs (3)
88_response.Headers[HeaderNames.ContentLength] = "0"; 120var headers = _response.Headers; 155var headers = _response.Headers;
Microsoft.AspNetCore.Session (1)
SessionMiddleware.cs (1)
146var responseHeaders = response.Headers;
Microsoft.AspNetCore.SpaProxy (1)
SpaProxyMiddleware.cs (1)
55context.Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
Microsoft.AspNetCore.SpaServices.Extensions (3)
Proxying\SpaProxy.cs (3)
175context.Response.Headers[header.Key] = header.Value.ToArray(); 180context.Response.Headers[header.Key] = header.Value.ToArray(); 184context.Response.Headers.Remove("transfer-encoding");
Microsoft.AspNetCore.StaticAssets (8)
Development\StaticAssetDevelopmentRuntimeHandler.cs (7)
98_context.Response.Headers.ETag = ""; 114_context.Response.Headers.ContentLength = stream.Length; 120_context.Response.Headers.ETag = new StringValues([$"\"{eTag}\"", weakETag]); 128_context.Response.Headers.ETag = ""; 130_context.Response.Headers.ETag = GetETag(fileInfo); 131_context.Response.Headers.ContentLength = fileInfo.Length; 132_context.Response.Headers.LastModified = fileInfo.LastModified.ToString("ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture);
StaticAssetsInvoker.cs (1)
233_logger.SendingFileRange(requestContext.Response.Headers.ContentRange, logPath);
Microsoft.AspNetCore.StaticFiles (2)
Helpers.cs (1)
46context.Response.Headers.Location = redirect;
StaticFileContext.cs (1)
388_logger.SendingFileRange(_response.Headers.ContentRange, logPath);
Microsoft.AspNetCore.TestHost (1)
ClientHandler.cs (1)
219foreach (var header in httpContext.Response.Headers)
Microsoft.AspNetCore.TestHost.Tests (25)
ClientHandlerTests.cs (8)
58Assert.NotNull(context.Response.Headers); 356context.Response.Headers["TestHeader"] = "TestValue:" + requestCount++; 375context.Response.Headers["TestHeader"] = "TestValue"; 408context.Response.Headers["TestHeader"] = "TestValue"; 427context.Response.Headers["TestHeader"] = "TestValue"; 446context.Response.Headers["TestHeader"] = "TestValue"; 468context.Response.Headers["TestHeader"] = "TestValue"; 526context.Response.Headers["TestHeader"] = "TestValue";
HttpContextBuilderTests.cs (15)
41Assert.NotNull(context.Response.Headers); 84c.Response.Headers["TestHeader"] = "TestValue"; 91Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 125c.Response.Headers["TestHeader"] = "TestValue"; 137Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 152c.Response.Headers["TestHeader"] = "TestValue"; 161Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 176c.Response.Headers["TestHeader"] = "TestValue"; 185Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 198c.Response.Headers["TestHeader"] = "TestValue"; 207Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 247c.Response.Headers["TestHeader"] = "TestValue"; 256Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 288c.Response.Headers["TestHeader"] = "TestValue"; 297Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
TestClientTests.cs (2)
413ctx.Response.Headers["test-header"] = "true"; 460ctx.Response.Headers["test-header"] = "true";
Microsoft.AspNetCore.WebSockets (2)
WebSocketMiddleware.cs (2)
165HandshakeHelpers.GenerateResponseHeaders(!_isH2WebSocket, _context.Request.Headers, subProtocol, _context.Response.Headers); 184_context.Response.Headers.SecWebSocketExtensions = response;
Microsoft.AspNetCore.WebSockets.Tests (1)
KestrelWebSocketHelpers.cs (1)
42ct.Response.Headers.Clear();
OutputCachingSample (1)
Startup.cs (1)
64context.Response.Headers.ETag = etag;
QueueSharing (1)
Program.cs (1)
66context.Response.Headers["Connection"] = "close";
RazorPagesWebSite (2)
Pages\Filters\TestPageFilter.cs (1)
16context.HttpContext.Response.Headers["PageFilterKey"] = "PageFilterValue";
Pages\Filters\TestPageModelFilter.cs (1)
16context.HttpContext.Response.Headers["PageModelFilterKey"] = "PageModelFilterValue";
ResponseCachingSample (1)
Startup.cs (1)
25context.Response.Headers.Vary = new string[] { "Accept-Encoding" };
ServerComparison.TestSites (4)
StartupResponses.cs (4)
28context.Response.Headers.Connection = "close"; 47context.Response.Headers.TransferEncoding = "chunked"; 56context.Response.Headers.Connection = "close"; 57context.Response.Headers.TransferEncoding = "chunked";
SignalR.Client.FunctionalTestApp (4)
Startup.cs (4)
126context.Response.Headers.AccessControlAllowOrigin = originHeader; 127context.Response.Headers.AccessControlAllowCredentials = "true"; 132context.Response.Headers.AccessControlAllowMethods = requestMethod; 138context.Response.Headers.AccessControlAllowHeaders = requestHeaders;
Sockets.FunctionalTests (5)
src\Servers\Kestrel\shared\test\TestApp.cs (2)
35response.Headers.ContentLength = bytes.Length; 69response.Headers.ContentLength = bytes.Length;
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
867response.Headers["Content-Length"] = new[] { "5" };
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (2)
113context.Response.Headers.Add(headerName, headerValue); 963context.Response.Headers[$"X-Custom-Header"] = headerStringValues;
WebPubSubWeb (1)
Program.cs (1)
54context.Response.Headers["WebHook-Allowed-Origin"] = "*";