13 implementations of
InMemory.FunctionalTests (2)
Http2\Http2ConnectionTests.cs (1)
293public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Http3\Http3ConnectionTests.cs (1)
828public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Microsoft.AspNetCore.Hosting.Tests (1)
WebHostTests.cs (1)
1376public StringValues this[string key]
Microsoft.AspNetCore.Http (1)
HeaderDictionary.cs (1)
67public StringValues this[string key]
Microsoft.AspNetCore.Owin (1)
DictionaryStringValuesWrapper.cs (1)
27StringValues IHeaderDictionary.this[string key]
Microsoft.AspNetCore.Server.HttpSys (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
66public StringValues this[string key]
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
220public StringValues this[string key]
Microsoft.AspNetCore.Server.IIS (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
66public StringValues this[string key]
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
220public StringValues this[string key]
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\Http\HttpHeaders.cs (1)
47StringValues IHeaderDictionary.this[string key]
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
Http1\Http1ConnectionTests.cs (1)
1198public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
66public StringValues this[string key]
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
220public StringValues this[string key]
634 writes to
Aspire.Dashboard (1)
Model\BrowserSecurityHeadersMiddleware.cs (1)
74context.Response.Headers["Referrer-Policy"] = "strict-origin-when-cross-origin";
Aspire.Dashboard.Tests (1)
OtlpApiKeyAuthenticationHandlerTests.cs (1)
98httpContext.Request.Headers[OtlpApiKeyAuthenticationHandler.ApiKeyHeaderName] = otlpApiKeyHeader;
BasicWebSite (1)
Filters\ServiceActionFilter.cs (1)
24context.HttpContext.Response.Headers["X-ServiceActionFilter"] = "True";
blazor-devserver (2)
Server\Startup.cs (2)
109httpContext.Response.Headers["Cross-Origin-Embedder-Policy"] = "require-corp"; 110httpContext.Response.Headers["Cross-Origin-Opener-Policy"] = "same-origin";
FormatterWebSite (1)
Controllers\SystemTextJsonOutputFormatterController.cs (1)
26HttpContext.Response.Headers["Test"] = "t";
Http3SampleApp (1)
Startup.cs (1)
24context.Response.Headers["test"] = "foo";
HttpAbstractions.SampleApp (1)
Program.cs (1)
23request.Headers["Custom"] = new[] { "Value1", "Value2" };
InMemory.FunctionalTests (54)
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)
293public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; } 341trailersFeature.Trailers["trailer-" + requestCount] = "true"; 3890context.Response.Headers["A"] = new string('a', headerValueLength); 3891context.Response.Headers["B"] = new string('b', headerValueLength);
Http2\Http2StreamTests.cs (6)
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; 2845context.Response.Headers["too_long_header"] = value; 3716context.Response.Headers[longHeaderName] = headerValue; 3755context.Response.Headers["my"] = headerValue;
Http2\Http2TestBase.cs (4)
284context.Response.Headers[name] = _4kHeaderValue; 356context.Response.Headers["Method"] = context.Request.Method; 372context.Response.Headers["path"] = context.Request.Path.ToString(); 373context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
Http3\Http3ConnectionTests.cs (2)
576trailersFeature.Trailers[$"trailer-{requestCount++}"] = "true"; 828public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Http3\Http3StreamTests.cs (5)
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; 2789context.Response.Headers["BigHeader"] = new string('!', 100); 2901c.Response.Headers["Header" + i] = i + "-" + headerText;
Http3\Http3TestBase.cs (3)
96context.Response.Headers["Method"] = context.Request.Method; 103context.Response.Headers["path"] = context.Request.Path.ToString(); 104context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
RequestTargetProcessingTests.cs (1)
71context.Response.Headers["Content-Length"] = new[] { "11" };
RequestTests.cs (3)
1921response.Headers["Content-Length"] = new[] { "11" }; 1967response.Headers["Content-Length"] = new[] { "11" }; 2050response.Headers["Content-Length"] = new[] { "11" };
ResponseTests.cs (14)
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" };
InProcessWebSite (12)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (10)
193context.Response.Headers["connection"] = "close"; 199context.Response.Headers["Server"] = "MyServer/7.8"; 448ctx.Response.Headers["UnknownHeader"] = "test123=foo"; 450ctx.Response.Headers["MultiHeader"] = new StringValues(new string[] { "1", "2" }); 456ctx.Response.Headers["EmptyHeader"] = ""; 479ctx.Request.Headers[headerName] = default; 481ctx.Request.Headers[headerName] = StringValues.Empty; 492ctx.Request.Headers[headerName] = default; 538ctx.Response.Headers["This will fail"] = "some value"; 729ctx.Response.Headers["BodyAsString"] = value;
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (2)
79context.Response.Headers["custom-header"] = "value"; 118context.Response.Headers[headerPair.Key] = headerPair.Value;
Interop.FunctionalTests (2)
Http2\Http2RequestTests.cs (2)
170c.Response.Headers["test"] = "abc"; 171c.Response.Headers[longKey] = longValue;
Microsoft.AspNetCore.Antiforgery.Test (6)
DefaultAntiforgeryTest.cs (6)
363context.HttpContext.Response.Headers[headerName] = headerValue; 997context.HttpContext.Response.Headers["X-Frame-Options"] = expectedHeaderValue; 1067context.HttpContext.Response.Headers["Cache-Control"] = "public"; 1266context.HttpContext.Response.Headers["Cache-Control"] = "public"; 1332context.HttpContext.Response.Headers[headerName] = headerValue; 1366context.HttpContext.Response.Headers[headerName] = headerValue;
Microsoft.AspNetCore.Authentication.Test (2)
WsFederation\WsFederationTest.cs (1)
352context.Response.Headers["EventHeader"] = "OnRemoteSignOut";
WsFederation\WsFederationTest_Handler.cs (1)
348context.Response.Headers["EventHeader"] = "OnRemoteSignOut";
Microsoft.AspNetCore.Components.Endpoints (4)
Builder\ResourceCollectionUrlEndpoint.cs (4)
214context.Response.Headers[HeaderNames.ContentEncoding] = "gzip"; 215context.Response.Headers[HeaderNames.Vary] = HeaderNames.AcceptEncoding; 226context.Response.Headers[HeaderNames.CacheControl] = "max-age=31536000, immutable"; 231context.Response.Headers[HeaderNames.CacheControl] = "no-cache, must-revalidate";
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (2)
44httpContext.Response.Headers["Cross-Origin-Embedder-Policy"] = "require-corp"; 45httpContext.Response.Headers["Cross-Origin-Opener-Policy"] = "same-origin";
Microsoft.AspNetCore.CookiePolicy.Test (10)
CookieChunkingTests.cs (7)
87context.Request.Headers["Cookie"] = new[] 118context.Request.Headers["Cookie"] = new[] 149context.Request.Headers["Cookie"] = new[] 170context.Request.Headers["Cookie"] = new[] 190context.Request.Headers["Cookie"] = new[] 270httpContext.Request.Headers["Cookie"] = new[] 290httpContext.Response.Headers[HeaderNames.SetCookie] = new[]
CookieConsentTests.cs (3)
569context.Response.Headers["ManualCookie"] = cookie; 622context.Response.Headers["ManualCookie"] = cookie; 667context.Response.Headers["ManualCookie"] = cookie;
Microsoft.AspNetCore.Cors.Test (1)
CorsServiceTests.cs (1)
667httpContext.Response.Headers["Vary"] = "Cookie";
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\AddServerTimingHeaderMiddleware.cs (1)
44httpContext.Response.Headers[ServerTimingHeaderName] = $"{existing}, reqlatency;dur={elapsedMs}";
Latency\RequestLatencyTelemetryMiddleware.cs (1)
68httpContext.Response.Headers[TelemetryConstants.ServerApplicationNameHeader] = _applicationName;
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.HeaderParsing.Tests (9)
HeaderParsingExtensionsTests.cs (1)
110context.Request.Headers["Date"] = date;
HeaderParsingFeatureTests.cs (8)
49Context.Request.Headers["Date"] = date; 67Context.Request.Headers["Date"] = currentDate; 68Context.Request.Headers["Test"] = futureDate; 90Context.Request.Headers["Date"] = date; 139Context.Request.Headers["Date"] = "Not a date."; 178Context.Request.Headers[firstHeaderKey.Name] = DateTimeOffset.Now.ToString("R", CultureInfo.InvariantCulture); 179Context.Request.Headers[thirdHeaderKey.Name] = DateTimeOffset.Now.ToString("R", CultureInfo.InvariantCulture); 196Context.Request.Headers[HeaderNames.CacheControl] = "max-age=604800";
Microsoft.AspNetCore.Http.Abstractions (3)
Internal\ParsingHelpers.cs (3)
60headers[key] = string.Join(',', value.Select(QuoteIfNeeded)); 98headers[key] = values.GetValueOrDefault(); 119headers[key] = existing + "," + string.Join(',', values.Select(QuoteIfNeeded));
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionDispatcherTests.cs (4)
771context.Request.Headers["header1"] = "h1"; 772context.Request.Headers["header2"] = "h2"; 773context.Request.Headers["header3"] = "h3"; 3758context.Request.Headers["Accept"] = "text/event-stream";
Microsoft.AspNetCore.Http.Extensions (4)
HeaderDictionaryTypeExtensions.cs (4)
61headers[name] = value.ToString(); 76headers[name] = new StringValues(values[0]!.ToString()); 85headers[name] = new StringValues(newValues); 127headers[name] = HeaderUtilities.FormatDate(value.GetValueOrDefault());
Microsoft.AspNetCore.Http.Extensions.Tests (106)
HeaderDictionaryTypeExtensionsTest.cs (6)
130context.Request.Headers["custom"] = "valid"; 140context.Request.Headers["custom"] = "invalid"; 159context.Request.Headers["custom"] = "valid"; 253context.Request.Headers["custom"] = "valid"; 264context.Request.Headers["custom"] = "invalid"; 283context.Request.Headers["custom"] = "valid";
HttpResponseJsonExtensionsTests.cs (2)
503httpContext.Response.Headers["Test"] = "t"; 535httpContext.Response.Headers["Test"] = "t";
RequestDelegateFactoryTests.cs (11)
633httpContext.Request.Headers["Custom"] = new(new[] { "4", "5", "6" }); 854httpContext.Request.Headers["Content-Type"] = "application/json"; 855httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 887httpContext.Request.Headers["Content-Type"] = "application/json"; 888httpContext.Request.Headers["Content-Length"] = "0"; 1934httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 1935httpContext.Request.Headers["Content-Length"] = "1"; 1967httpContext.Request.Headers["Content-Type"] = "application/json"; 1968httpContext.Request.Headers["Content-Length"] = "1000"; 2879httpContext.Request.Headers["Content-Type"] = "application/json"; 2880httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
RequestDelegateGenerator\CompileTimeCreationTests.cs (1)
528httpContext.Request.Headers[value] = value;
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (2)
223httpContext.Request.Headers["Content-Type"] = "application/json"; 228httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (11)
623httpContext.Request.Headers["Content-Type"] = "application/json"; 627httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 650httpContext.Request.Headers["Content-Type"] = "application/json"; 654httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 677httpContext.Request.Headers["Content-Type"] = "application/json"; 681httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 704httpContext.Request.Headers["Content-Type"] = "application/json"; 708httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 731httpContext.Request.Headers["Content-Type"] = "application/json"; 735httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 765httpContext.Request.Headers["Custom"] = new(new[] { "4", "5", "6" });
RequestDelegateGenerator\RequestDelegateCreationTests.AsParameters.cs (1)
96httpContext.Request.Headers[customHeaderName] = originalHeaderParam.ToString(NumberFormatInfo.InvariantInfo);
RequestDelegateGenerator\RequestDelegateCreationTests.BindAsync.cs (4)
215httpContext.Request.Headers["Content-Type"] = "application/json"; 216httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 271httpContext.Request.Headers["Content-Type"] = "application/json"; 272httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
RequestDelegateGenerator\RequestDelegateCreationTests.cs (2)
213httpContext.Request.Headers["headerValue"] = requestData; 589httpContext.Request.Headers["Custom"] = new(new[] { "4", "5", "6" });
RequestDelegateGenerator\RequestDelegateCreationTests.Filters.cs (1)
235httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary";
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (30)
36httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 71httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 106httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 144httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 182httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 223httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 260httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 296httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 322httpContext.Request.Headers["Content-Type"] = "application/xml"; 323httpContext.Request.Headers["Content-Length"] = "1"; 370httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 403httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 452httpContext.Request.Headers[headerName] = headerValue; 453httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 492httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 551httpContext.Request.Headers["Content-Type"] = contentType; 598httpContext.Request.Headers["Content-Type"] = contentType; 645httpContext.Request.Headers["Content-Type"] = contentType; 674httpContext.Request.Headers["Content-Type"] = contentType; 707httpContext.Request.Headers["Content-Type"] = contentType; 737httpContext.Request.Headers["Content-Type"] = contentType; 767httpContext.Request.Headers["Content-Type"] = contentType; 830httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 874httpContext.Request.Headers["Content-Type"] = contentType; 930httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 931httpContext.Request.Headers["Content-Length"] = "1"; 962httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 963httpContext.Request.Headers["Content-Length"] = "2049"; 999httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 1000httpContext.Request.Headers["Content-Length"] = "2049";
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBody.cs (12)
86httpContext.Request.Headers["Content-Type"] = "application/json"; 91httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 106httpContext.Request.Headers["Content-Type"] = "application/json"; 107httpContext.Request.Headers["Content-Length"] = "0"; 234httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 275httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture); 319httpContext.Request.Headers["Content-Length"] = requestBodyBytes.Length.ToString(CultureInfo.InvariantCulture); 360httpContext.Request.Headers["Content-Length"] = requestBodyBytes.Length.ToString(CultureInfo.InvariantCulture); 398httpContext.Request.Headers["Content-Type"] = "application/json"; 399httpContext.Request.Headers["Content-Length"] = "0"; 427httpContext.Request.Headers["Content-Type"] = "application/json"; 432httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBodyOrService.cs (2)
198httpContext.Request.Headers["Content-Type"] = "application/json"; 199httpContext.Request.Headers["Content-Length"] = "0";
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (13)
384httpContext.Request.Headers["Content-Type"] = "application/xml"; 385httpContext.Request.Headers["Content-Length"] = "1"; 435httpContext.Request.Headers["Content-Type"] = "application/xml"; 481httpContext.Request.Headers["Content-Type"] = "application/json"; 482httpContext.Request.Headers["Content-Length"] = "1"; 517httpContext.Request.Headers["Content-Type"] = "application/json"; 518httpContext.Request.Headers["Content-Length"] = "1"; 558httpContext.Request.Headers["Content-Type"] = "application/json"; 559httpContext.Request.Headers["Content-Length"] = "1"; 597httpContext.Request.Headers["Content-Type"] = "application/json"; 598httpContext.Request.Headers["Content-Length"] = "1"; 637httpContext.Request.Headers["Content-Type"] = "application/json"; 638httpContext.Request.Headers["Content-Length"] = "1";
RequestDelegateGenerator\RuntimeCreationTests.ComplexFormBinding.cs (7)
31httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 67httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 99httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 136httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 173httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary"; 208httpContext.Request.Headers["Content-Type"] = "application/x-www-form-urlencoded"; 245httpContext.Request.Headers["Content-Type"] = "multipart/form-data;boundary=some-boundary";
ResponseExtensionTests.cs (1)
15context.Response.Headers["custom"] = "value";
Microsoft.AspNetCore.Http.Features (89)
IHeaderDictionary.Keyed.cs (89)
11StringValues Accept { get => this[HeaderNames.Accept]; set => this[HeaderNames.Accept] = value; } 14StringValues AcceptCharset { get => this[HeaderNames.AcceptCharset]; set => this[HeaderNames.AcceptCharset] = value; } 17StringValues AcceptEncoding { get => this[HeaderNames.AcceptEncoding]; set => this[HeaderNames.AcceptEncoding] = value; } 20StringValues AcceptLanguage { get => this[HeaderNames.AcceptLanguage]; set => this[HeaderNames.AcceptLanguage] = value; } 23StringValues AcceptRanges { get => this[HeaderNames.AcceptRanges]; set => this[HeaderNames.AcceptRanges] = value; } 26StringValues AccessControlAllowCredentials { get => this[HeaderNames.AccessControlAllowCredentials]; set => this[HeaderNames.AccessControlAllowCredentials] = value; } 29StringValues AccessControlAllowHeaders { get => this[HeaderNames.AccessControlAllowHeaders]; set => this[HeaderNames.AccessControlAllowHeaders] = value; } 32StringValues AccessControlAllowMethods { get => this[HeaderNames.AccessControlAllowMethods]; set => this[HeaderNames.AccessControlAllowMethods] = value; } 35StringValues AccessControlAllowOrigin { get => this[HeaderNames.AccessControlAllowOrigin]; set => this[HeaderNames.AccessControlAllowOrigin] = value; } 38StringValues AccessControlExposeHeaders { get => this[HeaderNames.AccessControlExposeHeaders]; set => this[HeaderNames.AccessControlExposeHeaders] = value; } 41StringValues AccessControlMaxAge { get => this[HeaderNames.AccessControlMaxAge]; set => this[HeaderNames.AccessControlMaxAge] = value; } 44StringValues AccessControlRequestHeaders { get => this[HeaderNames.AccessControlRequestHeaders]; set => this[HeaderNames.AccessControlRequestHeaders] = value; } 47StringValues AccessControlRequestMethod { get => this[HeaderNames.AccessControlRequestMethod]; set => this[HeaderNames.AccessControlRequestMethod] = value; } 50StringValues Age { get => this[HeaderNames.Age]; set => this[HeaderNames.Age] = value; } 53StringValues Allow { get => this[HeaderNames.Allow]; set => this[HeaderNames.Allow] = value; } 56StringValues AltSvc { get => this[HeaderNames.AltSvc]; set => this[HeaderNames.AltSvc] = value; } 59StringValues Authorization { get => this[HeaderNames.Authorization]; set => this[HeaderNames.Authorization] = value; } 62StringValues Baggage { get => this[HeaderNames.Baggage]; set => this[HeaderNames.Baggage] = value; } 65StringValues CacheControl { get => this[HeaderNames.CacheControl]; set => this[HeaderNames.CacheControl] = value; } 68StringValues Connection { get => this[HeaderNames.Connection]; set => this[HeaderNames.Connection] = value; } 71StringValues ContentDisposition { get => this[HeaderNames.ContentDisposition]; set => this[HeaderNames.ContentDisposition] = value; } 74StringValues ContentEncoding { get => this[HeaderNames.ContentEncoding]; set => this[HeaderNames.ContentEncoding] = value; } 77StringValues ContentLanguage { get => this[HeaderNames.ContentLanguage]; set => this[HeaderNames.ContentLanguage] = value; } 80StringValues ContentLocation { get => this[HeaderNames.ContentLocation]; set => this[HeaderNames.ContentLocation] = value; } 83StringValues ContentMD5 { get => this[HeaderNames.ContentMD5]; set => this[HeaderNames.ContentMD5] = value; } 86StringValues ContentRange { get => this[HeaderNames.ContentRange]; set => this[HeaderNames.ContentRange] = value; } 89StringValues ContentSecurityPolicy { get => this[HeaderNames.ContentSecurityPolicy]; set => this[HeaderNames.ContentSecurityPolicy] = value; } 92StringValues ContentSecurityPolicyReportOnly { get => this[HeaderNames.ContentSecurityPolicyReportOnly]; set => this[HeaderNames.ContentSecurityPolicyReportOnly] = value; } 95StringValues ContentType { get => this[HeaderNames.ContentType]; set => this[HeaderNames.ContentType] = value; } 98StringValues CorrelationContext { get => this[HeaderNames.CorrelationContext]; set => this[HeaderNames.CorrelationContext] = value; } 101StringValues Cookie { get => this[HeaderNames.Cookie]; set => this[HeaderNames.Cookie] = value; } 104StringValues Date { get => this[HeaderNames.Date]; set => this[HeaderNames.Date] = value; } 107StringValues ETag { get => this[HeaderNames.ETag]; set => this[HeaderNames.ETag] = value; } 110StringValues Expires { get => this[HeaderNames.Expires]; set => this[HeaderNames.Expires] = value; } 113StringValues Expect { get => this[HeaderNames.Expect]; set => this[HeaderNames.Expect] = value; } 116StringValues From { get => this[HeaderNames.From]; set => this[HeaderNames.From] = value; } 119StringValues GrpcAcceptEncoding { get => this[HeaderNames.GrpcAcceptEncoding]; set => this[HeaderNames.GrpcAcceptEncoding] = value; } 122StringValues GrpcEncoding { get => this[HeaderNames.GrpcEncoding]; set => this[HeaderNames.GrpcEncoding] = value; } 125StringValues GrpcMessage { get => this[HeaderNames.GrpcMessage]; set => this[HeaderNames.GrpcMessage] = value; } 128StringValues GrpcStatus { get => this[HeaderNames.GrpcStatus]; set => this[HeaderNames.GrpcStatus] = value; } 131StringValues GrpcTimeout { get => this[HeaderNames.GrpcTimeout]; set => this[HeaderNames.GrpcTimeout] = value; } 134StringValues Host { get => this[HeaderNames.Host]; set => this[HeaderNames.Host] = value; } 137StringValues KeepAlive { get => this[HeaderNames.KeepAlive]; set => this[HeaderNames.KeepAlive] = value; } 140StringValues IfMatch { get => this[HeaderNames.IfMatch]; set => this[HeaderNames.IfMatch] = value; } 143StringValues IfModifiedSince { get => this[HeaderNames.IfModifiedSince]; set => this[HeaderNames.IfModifiedSince] = value; } 146StringValues IfNoneMatch { get => this[HeaderNames.IfNoneMatch]; set => this[HeaderNames.IfNoneMatch] = value; } 149StringValues IfRange { get => this[HeaderNames.IfRange]; set => this[HeaderNames.IfRange] = value; } 152StringValues IfUnmodifiedSince { get => this[HeaderNames.IfUnmodifiedSince]; set => this[HeaderNames.IfUnmodifiedSince] = value; } 155StringValues LastModified { get => this[HeaderNames.LastModified]; set => this[HeaderNames.LastModified] = value; } 158StringValues Link { get => this[HeaderNames.Link]; set => this[HeaderNames.Link] = value; } 161StringValues Location { get => this[HeaderNames.Location]; set => this[HeaderNames.Location] = value; } 164StringValues MaxForwards { get => this[HeaderNames.MaxForwards]; set => this[HeaderNames.MaxForwards] = value; } 167StringValues Origin { get => this[HeaderNames.Origin]; set => this[HeaderNames.Origin] = value; } 170StringValues Pragma { get => this[HeaderNames.Pragma]; set => this[HeaderNames.Pragma] = value; } 173StringValues ProxyAuthenticate { get => this[HeaderNames.ProxyAuthenticate]; set => this[HeaderNames.ProxyAuthenticate] = value; } 176StringValues ProxyAuthorization { get => this[HeaderNames.ProxyAuthorization]; set => this[HeaderNames.ProxyAuthorization] = value; } 179StringValues ProxyConnection { get => this[HeaderNames.ProxyConnection]; set => this[HeaderNames.ProxyConnection] = value; } 182StringValues Range { get => this[HeaderNames.Range]; set => this[HeaderNames.Range] = value; } 185StringValues Referer { get => this[HeaderNames.Referer]; set => this[HeaderNames.Referer] = value; } 188StringValues RetryAfter { get => this[HeaderNames.RetryAfter]; set => this[HeaderNames.RetryAfter] = value; } 191StringValues RequestId { get => this[HeaderNames.RequestId]; set => this[HeaderNames.RequestId] = value; } 194StringValues SecWebSocketAccept { get => this[HeaderNames.SecWebSocketAccept]; set => this[HeaderNames.SecWebSocketAccept] = value; } 197StringValues SecWebSocketKey { get => this[HeaderNames.SecWebSocketKey]; set => this[HeaderNames.SecWebSocketKey] = value; } 200StringValues SecWebSocketProtocol { get => this[HeaderNames.SecWebSocketProtocol]; set => this[HeaderNames.SecWebSocketProtocol] = value; } 203StringValues SecWebSocketVersion { get => this[HeaderNames.SecWebSocketVersion]; set => this[HeaderNames.SecWebSocketVersion] = value; } 206StringValues SecWebSocketExtensions { get => this[HeaderNames.SecWebSocketExtensions]; set => this[HeaderNames.SecWebSocketExtensions] = value; } 209StringValues Server { get => this[HeaderNames.Server]; set => this[HeaderNames.Server] = value; } 212StringValues SetCookie { get => this[HeaderNames.SetCookie]; set => this[HeaderNames.SetCookie] = value; } 215StringValues StrictTransportSecurity { get => this[HeaderNames.StrictTransportSecurity]; set => this[HeaderNames.StrictTransportSecurity] = value; } 218StringValues TE { get => this[HeaderNames.TE]; set => this[HeaderNames.TE] = value; } 221StringValues Trailer { get => this[HeaderNames.Trailer]; set => this[HeaderNames.Trailer] = value; } 224StringValues TransferEncoding { get => this[HeaderNames.TransferEncoding]; set => this[HeaderNames.TransferEncoding] = value; } 227StringValues Translate { get => this[HeaderNames.Translate]; set => this[HeaderNames.Translate] = value; } 230StringValues TraceParent { get => this[HeaderNames.TraceParent]; set => this[HeaderNames.TraceParent] = value; } 233StringValues TraceState { get => this[HeaderNames.TraceState]; set => this[HeaderNames.TraceState] = value; } 236StringValues Upgrade { get => this[HeaderNames.Upgrade]; set => this[HeaderNames.Upgrade] = value; } 239StringValues UpgradeInsecureRequests { get => this[HeaderNames.UpgradeInsecureRequests]; set => this[HeaderNames.UpgradeInsecureRequests] = value; } 242StringValues UserAgent { get => this[HeaderNames.UserAgent]; set => this[HeaderNames.UserAgent] = value; } 245StringValues Vary { get => this[HeaderNames.Vary]; set => this[HeaderNames.Vary] = value; } 248StringValues Via { get => this[HeaderNames.Via]; set => this[HeaderNames.Via] = value; } 251StringValues Warning { get => this[HeaderNames.Warning]; set => this[HeaderNames.Warning] = value; } 254StringValues WebSocketSubProtocols { get => this[HeaderNames.WebSocketSubProtocols]; set => this[HeaderNames.WebSocketSubProtocols] = value; } 257StringValues WWWAuthenticate { get => this[HeaderNames.WWWAuthenticate]; set => this[HeaderNames.WWWAuthenticate] = value; } 260StringValues XContentTypeOptions { get => this[HeaderNames.XContentTypeOptions]; set => this[HeaderNames.XContentTypeOptions] = value; } 263StringValues XFrameOptions { get => this[HeaderNames.XFrameOptions]; set => this[HeaderNames.XFrameOptions] = value; } 266StringValues XPoweredBy { get => this[HeaderNames.XPoweredBy]; set => this[HeaderNames.XPoweredBy] = value; } 269StringValues XRequestedWith { get => this[HeaderNames.XRequestedWith]; set => this[HeaderNames.XRequestedWith] = value; } 272StringValues XUACompatible { get => this[HeaderNames.XUACompatible]; set => this[HeaderNames.XUACompatible] = value; } 275StringValues XXSSProtection { get => this[HeaderNames.XXSSProtection]; set => this[HeaderNames.XXSSProtection] = value; }
Microsoft.AspNetCore.Http.Microbenchmarks (2)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (2)
223httpContext.Request.Headers["Content-Type"] = "application/json"; 228httpContext.Request.Headers["Content-Length"] = stream.Length.ToString(CultureInfo.InvariantCulture);
Microsoft.AspNetCore.Http.Results.Tests (3)
CreatedOfTResultTests.cs (2)
67httpContext.Response.Headers["Location"] = "/different/location/"; 86httpContext.Response.Headers["Location"] = "/different/location/";
CreatedResultTests.cs (1)
52httpContext.Response.Headers["Location"] = "/different/location/";
Microsoft.AspNetCore.Http.Tests (1)
Internal\DefaultHttpRequestTests.cs (1)
175request.Headers["Cookie"] = newCookies;
Microsoft.AspNetCore.HttpLogging.Tests (32)
HttpLoggingMiddlewareTests.cs (23)
260httpContext.Request.Headers["foo"] = "bar"; 278httpContext.Request.Headers["Connection"] = "keep-alive"; 280httpContext.Request.Headers["foo"] = "bar"; 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; 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"; 1962httpContext.Request.Headers["Connection"] = "keep-alive";
W3CLoggingMiddlewareTests.cs (9)
59httpContext.Request.Headers["Referer"] = "bar"; 83httpContext.Request.Headers["Cookie"] = "Snickerdoodle"; 127httpContext.Request.Headers["Cookie"] = "Snickerdoodle"; 128httpContext.Request.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348"; 169httpContext.Request.Headers["Cookie"] = "Snickerdoodle"; 200httpContext.Request.Headers["Cookie"] = "Snickerdoodle"; 201httpContext.Request.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348"; 247httpContext.Request.Headers["Cookie"] = "Snickerdoodle"; 248httpContext.Request.Headers["x-forwarded-for"] = "1.3.3.7, 2001:db8:85a3:8d3:1319:8a2e:370:7348";
Microsoft.AspNetCore.HttpOverrides (8)
ForwardedHeadersMiddleware.cs (8)
310requestHeaders[_options.OriginalForHeaderName] = new IPEndPoint(connection.RemoteIpAddress, connection.RemotePort).ToString(); 315requestHeaders[_options.ForwardedForHeaderName] = 330requestHeaders[_options.OriginalProtoHeaderName] = request.Scheme; 334requestHeaders[_options.ForwardedProtoHeaderName] = 348requestHeaders[_options.OriginalHostHeaderName] = request.Host.ToString(); 352requestHeaders[_options.ForwardedHostHeaderName] = 368requestHeaders[_options.OriginalPrefixHeaderName] = request.PathBase.ToString(); 374requestHeaders[_options.ForwardedPrefixHeaderName] =
Microsoft.AspNetCore.HttpOverrides.Tests (47)
CertificateForwardingTest.cs (5)
71c.Request.Headers["X-Client-Cert"] = Convert.ToBase64String(Certificates.SelfSignedValidWithNoEku.RawData); 110c.Request.Headers["X-Client-Cert"] = Convert.ToBase64String(Certificates.SelfSignedValidWithNoEku.RawData); 148c.Request.Headers["X-ARR-ClientCert"] = Convert.ToBase64String(Certificates.SelfSignedValidWithNoEku.RawData); 186c.Request.Headers["not-the-right-header"] = Convert.ToBase64String(Certificates.SelfSignedValidWithNoEku.RawData); 224c.Request.Headers["X-Client-Cert"] = "OOPS" + Convert.ToBase64String(Certificates.SelfSignedValidWithNoEku.RawData);
ForwardedHeadersMiddlewareTest.cs (42)
40c.Request.Headers["X-Forwarded-For"] = "11.111.111.11:9090"; 76c.Request.Headers["X-Forwarded-For"] = header; 134c.Request.Headers["X-Forwarded-For"] = header; 172c.Request.Headers["X-Forwarded-For"] = "10.0.0.1:1234"; 245c.Request.Headers["X-Forwarded-For"] = header; 277c.Request.Headers["X-Forwarded-For"] = "BAD-IP"; 306c.Request.Headers["X-Forwarded-Host"] = "testhost"; 378c.Request.Headers["X-Forwarded-Host"] = hostHeader; 463c.Request.Headers["X-Forwarded-Host"] = hostHeader; 513ctx.Request.Headers["X-forwarded-Host"] = hostHeader; 564ctx.Request.Headers["X-forwarded-Host"] = hostHeader; 600ctx.Request.Headers["X-forwarded-Host"] = "stuff:523, bar.foo.com:432, bar.com:80"; 636c.Request.Headers["X-Forwarded-Proto"] = header; 690c.Request.Headers["X-Forwarded-Proto"] = scheme; 747c.Request.Headers["X-Forwarded-Proto"] = scheme; 785c.Request.Headers["X-Forwarded-Proto"] = protoHeader; 786c.Request.Headers["X-Forwarded-For"] = forHeader; 827c.Request.Headers["X-Forwarded-Proto"] = protoHeader; 828c.Request.Headers["X-Forwarded-For"] = forHeader; 877c.Request.Headers["X-Forwarded-Proto"] = protoHeader; 878c.Request.Headers["X-Forwarded-For"] = forHeader; 918c.Request.Headers["X-Forwarded-Proto"] = "Protocol"; 919c.Request.Headers["X-Forwarded-For"] = "11.111.111.11"; 920c.Request.Headers["X-Forwarded-Host"] = "testhost"; 921c.Request.Headers["X-Forwarded-Prefix"] = "/pathbase"; 953c.Request.Headers["X-Forwarded-Proto"] = "Protocol"; 954c.Request.Headers["X-Forwarded-For"] = "11.111.111.11"; 955c.Request.Headers["X-Forwarded-Host"] = "otherhost"; 956c.Request.Headers["X-Forwarded-Prefix"] = "/pathbase"; 988c.Request.Headers["X-Forwarded-Proto"] = "Protocol"; 989c.Request.Headers["X-Forwarded-For"] = "11.111.111.11"; 1042c.Request.Headers["X-Forwarded-For"] = forHeader; 1081c.Request.Headers["X-Forwarded-Proto"] = header; 1118c.Request.Headers["X-Forwarded-Proto"] = header; 1157c.Request.Headers["X-Forwarded-Prefix"] = forwardedPrefix; 1200c.Request.Headers["X-Forwarded-Prefix"] = forwardedPrefix; 1235c.Request.Headers["X-Forwarded-Prefix"] = forwardedPrefix; 1279c.Request.Headers["X-Forwarded-For"] = forwardedFor; 1280c.Request.Headers["X-Forwarded-Host"] = forwardedHost; 1281c.Request.Headers["X-Forwarded-Proto"] = forwardedProto; 1282c.Request.Headers["X-Forwarded-Prefix"] = forwardedPrefix; 1325c.Request.Headers["X-Forwarded-Prefix"] = forwardedPrefix;
Microsoft.AspNetCore.Mvc.Core.Test (4)
AcceptedResultTests.cs (1)
92httpContext.Response.Headers["Location"] = "/different/location/";
CreatedResultTests.cs (1)
101httpContext.Response.Headers["Location"] = "/different/location/";
Filters\MiddlewareFilterTest.cs (2)
93httpContext.Response.Headers["h1"] = "pipeline1"; 101httpContext.Response.Headers["h1"] = httpContext.Response.Headers["h1"] + "-pipeline2";
Microsoft.AspNetCore.Mvc.Cors.Test (2)
CorsAuthorizationFilterTest.cs (2)
196headers[CorsConstants.AccessControlMaxAge] = 198headers[CorsConstants.AccessControlAllowOrigin] = result1.AllowedOrigin;
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerOutputFormatterTest.cs (1)
804request.Headers["Accept-Charset"] = MediaTypeHeaderValue.Parse(contentType).Charset.ToString();
XmlSerializerOutputFormatterTest.cs (1)
586request.Headers["Accept-Charset"] = MediaTypeHeaderValue.Parse(contentType).Charset.ToString();
Microsoft.AspNetCore.Mvc.IntegrationTests (4)
BindingSourceMetadataProviderIntegrationTest.cs (1)
136request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}";
FormCollectionModelBindingIntegrationTest.cs (1)
165request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}";
FormFileModelBindingIntegrationTest.cs (1)
1270request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}";
TryUpdateModelIntegrationTest.cs (1)
1282request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}";
Microsoft.AspNetCore.Mvc.TagHelpers.Test (10)
CacheTagHelperTest.cs (2)
156cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2"; 178cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";
CacheTagKeyTest.cs (6)
211cacheTagHelper.ViewContext.HttpContext.Request.Headers["Cookie"] = 238headers["Accept-Language"] = "en-us;charset=utf8"; 239headers["Accept-Encoding"] = "utf8"; 240headers["X-CustomHeader"] = "Header-Value"; 404cacheTagHelper.ViewContext.HttpContext.Request.Headers["Content-Type"] = "text/html"; 431cacheTagHelper.ViewContext.HttpContext.Request.Headers["Content-Type"] = "text/html";
DistributedCacheTagHelperTest.cs (2)
208cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2"; 232cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";
Microsoft.AspNetCore.OutputCaching (1)
OutputCacheEntry.cs (1)
120headers[header.Name] = header.Value;
Microsoft.AspNetCore.OutputCaching.Tests (16)
OutputCacheAttributeTests.cs (2)
78context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 79context.HttpContext.Request.Headers["HeaderB"] = "ValueB";
OutputCacheKeyProviderTests.cs (10)
145context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 146context.HttpContext.Request.Headers["HeaderB"] = "ValueB"; 158context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 170context.HttpContext.Request.Headers["HeaderA"] = "ValueB"; 267context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 268context.HttpContext.Request.Headers["HeaderB"] = "ValueB"; 323context.HttpContext.Request.Headers["HeaderA"] = "ValueA" + KeyDelimiter; 324context.HttpContext.Request.Headers["HeaderB"] = "ValueB"; 337context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 338context.HttpContext.Request.Headers["HeaderB"] = "ValueB" + KeyDelimiter;
OutputCacheMiddlewareTests.cs (1)
106context.HttpContext.Response.Headers["MyHeader"] = "OldValue";
OutputCachePolicyBuilderTests.cs (2)
107context.HttpContext.Request.Headers["HeaderA"] = "ValueA"; 108context.HttpContext.Request.Headers["HeaderB"] = "ValueB";
TestUtils.cs (1)
37headers.Headers["X-Value"] = guid;
Microsoft.AspNetCore.Owin (1)
DictionaryStringArrayWrapper.cs (1)
29set { Inner[key] = value; }
Microsoft.AspNetCore.Owin.Tests (2)
OwinEnvironmentTests.cs (2)
25context.Request.Headers["CustomRequestHeader"] = "CustomRequestValue"; 32context.Response.Headers["CustomResponseHeader"] = "CustomResponseValue";
Microsoft.AspNetCore.ResponseCaching (3)
ResponseCachingMiddleware.cs (3)
163context.HttpContext.Response.Headers[key] = values; 175response.Headers[header.Key] = header.Value; 316context.CachedResponse.Headers[header.Key] = header.Value;
Microsoft.AspNetCore.ResponseCaching.Tests (31)
ResponseCachingMiddlewareTests.cs (14)
198context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 203context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow); 208context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 229context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 230context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 235context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 236context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow); 241context.CachedResponseHeaders[HeaderNames.Date] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 242context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 262context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)); 281context.CachedResponseHeaders[HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)); 321context.CachedResponseHeaders[HeaderNames.ETag] = responseETag.ToString(); 336context.CachedResponseHeaders[HeaderNames.ETag] = "\"E2\""; 349context.CachedResponseHeaders[HeaderNames.ETag] = "\"E2\"";
ResponseCachingPolicyProviderTests.cs (16)
508context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 526context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 530context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow); 547context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 567context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 589context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 595context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow); 610context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 616context.CachedResponseHeaders[HeaderNames.Expires] = HeaderUtilities.FormatDate(utcNow); 634context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 658context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 682context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 705context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 729context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 753context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue() 778context.CachedResponseHeaders[HeaderNames.CacheControl] = new CacheControlHeaderValue()
TestUtils.cs (1)
56headers.Headers["X-Value"] = guid;
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 (24)
Matching\ContentEncodingNegotiationMatcherPolicyTest.cs (22)
80httpContext.Request.Headers["Accept-Encoding"] = "gzip, br"; 100httpContext.Request.Headers["Accept-Encoding"] = "br"; 120httpContext.Request.Headers["Accept-Encoding"] = "br"; 140httpContext.Request.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0"; 160httpContext.Request.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0"; 180httpContext.Request.Headers["Accept-Encoding"] = "gzip, br"; 199httpContext.Request.Headers["Accept-Encoding"] = "zstd"; 220httpContext.Request.Headers["Accept-Encoding"] = "zstd"; 241httpContext.Request.Headers["Accept-Encoding"] = "gzip, br"; 260httpContext.Request.Headers["Accept-Encoding"] = "br, gzip"; 279httpContext.Request.Headers["Accept-Encoding"] = "identity"; 298httpContext.Request.Headers["Accept-Encoding"] = "identity"; 317httpContext.Request.Headers["Accept-Encoding"] = ""; 449httpContext.Request.Headers["Accept-Encoding"] = "gzip, br"; 467httpContext.Request.Headers["Accept-Encoding"] = "br"; 485httpContext.Request.Headers["Accept-Encoding"] = "br"; 503httpContext.Request.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0"; 521httpContext.Request.Headers["Accept-Encoding"] = "gzip;q=0.5, br;q=1.0"; 539httpContext.Request.Headers["Accept-Encoding"] = "gzip, br"; 557httpContext.Request.Headers["Accept-Encoding"] = "identity"; 575httpContext.Request.Headers["Accept-Encoding"] = "identity"; 593httpContext.Request.Headers["Accept-Encoding"] = "";
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (2)
374httpContext.Request.Headers[HeaderNames.Origin] = "example.com"; 375httpContext.Request.Headers[HeaderNames.AccessControlRequestMethod] = httpMethod;
Microsoft.AspNetCore.Security.Microbenchmarks (3)
ChunkingCookieManagerBenchmark.cs (3)
36_httpContext.Request.Headers["Cookie"] = new[] 55_httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty; 62_httpContext.Response.Headers[HeaderNames.SetCookie] = StringValues.Empty;
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (66)
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
RequestBodyTests.cs (6)
261httpContext.Request.Headers[HeaderNames.ContentLength] = "123"; 264httpContext.Request.Headers[HeaderNames.ContentLength] = "456"; 267httpContext.Request.Headers[HeaderNames.ContentLength] = StringValues.Empty; 276httpContext.Request.Headers["Custom-Header"] = "foo"; 278httpContext.Request.Headers["Custom-Header"] = "bar"; 280httpContext.Request.Headers["Custom-Header"] = StringValues.Empty;
ResponseBodyTests.cs (6)
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 (6)
48responseHeaders["WWW-Authenticate"] = new string[] { "custom1" }; 74responseHeaders["WWW-Authenticate"] = new string[] { "custom1, and custom2", "custom3" }; 99responseHeaders["Custom-Header1"] = new string[] { "custom1, and custom2", "custom3" }; 124responseHeaders["Custom-Header1"] = new string[] { "Dašta" }; 145responseHeaders["Connection"] = new string[] { "Close" }; 192responseHeaders["Transfer-Encoding"] = new string[] { "chunked" };
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 (1)
Internal\Http3\Http3Stream.cs (1)
1234ResponseHeaders[WebTransportSession.VersionHeaderPrefix] = version;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (10)
Http1\Http1ConnectionTests.cs (1)
1198public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Http3\Http3QPackEncoderTests.cs (1)
120headers["new-header"] = "value";
HttpHeadersTests.cs (1)
307httpHeaders["Cache-Control"] = "no-cache";
HttpRequestHeadersTests.cs (4)
181headers["custom"] = v3; 838headers["content-length"] = "1024"; 840headers["unknown"] = "value"; 842headers["host"] = "myhost";
HttpResponseHeadersTests.cs (3)
404headers["content-length"] = "1024"; 406headers["unknown"] = "value"; 408headers["host"] = "myhost";
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (13)
HeaderCollectionBenchmark.cs (1)
110_response.Headers[HeaderNames.ContentLength] = "0";
Http2\Http2ConnectionBenchmarkBase.cs (5)
53_httpRequestHeaders[InternalHeaderNames.Method] = new StringValues("GET"); 54_httpRequestHeaders[InternalHeaderNames.Path] = new StringValues("/"); 55_httpRequestHeaders[InternalHeaderNames.Scheme] = new StringValues("http"); 56_httpRequestHeaders[InternalHeaderNames.Authority] = new StringValues("localhost:80"); 65_httpRequestHeaders[HeaderNames.Cookie] = cookies;
Http2\Http2ConnectionHeadersBenchmark.cs (1)
38httpContext.Response.Headers[headerName] = "The quick brown fox jumps over the lazy dog.";
Http3\Http3ConnectionBenchmarkBase.cs (4)
39_httpRequestHeaders[InternalHeaderNames.Method] = new StringValues("GET"); 40_httpRequestHeaders[InternalHeaderNames.Path] = new StringValues("/"); 41_httpRequestHeaders[InternalHeaderNames.Scheme] = new StringValues("http"); 42_httpRequestHeaders[InternalHeaderNames.Authority] = new StringValues("localhost:80");
ResponseHeaderCollectionBenchmark.cs (1)
88_response.Headers[HeaderNames.ContentLength] = "0";
ResponseHeadersWritingBenchmark.cs (1)
103_responseHeadersDict["X-Powered-By"] = "ASP.NET";
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 (2)
Proxying\SpaProxy.cs (2)
175context.Response.Headers[header.Key] = header.Value.ToArray(); 180context.Response.Headers[header.Key] = header.Value.ToArray();
Microsoft.AspNetCore.TestHost.Tests (16)
ClientHandlerTests.cs (7)
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 (7)
84c.Response.Headers["TestHeader"] = "TestValue"; 125c.Response.Headers["TestHeader"] = "TestValue"; 152c.Response.Headers["TestHeader"] = "TestValue"; 176c.Response.Headers["TestHeader"] = "TestValue"; 198c.Response.Headers["TestHeader"] = "TestValue"; 247c.Response.Headers["TestHeader"] = "TestValue"; 288c.Response.Headers["TestHeader"] = "TestValue";
TestClientTests.cs (2)
413ctx.Response.Headers["test-header"] = "true"; 460ctx.Response.Headers["test-header"] = "true";
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";
Sockets.FunctionalTests (2)
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
867response.Headers["Content-Length"] = new[] { "5" };
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (1)
963context.Response.Headers[$"X-Custom-Header"] = headerStringValues;
WebPubSubWeb (1)
Program.cs (1)
54context.Response.Headers["WebHook-Allowed-Origin"] = "*";
293 references to
ControllersFromServicesClassLibrary (1)
ControllerWithConstructorInjection.cs (1)
33ActionContext.HttpContext.Request.Headers["Test-Header"]);
IISSample (1)
Startup.cs (1)
47await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
InMemory.FunctionalTests (11)
ChunkedRequestTests.cs (1)
592Assert.True(string.IsNullOrEmpty(request.Headers["X-Trailer-Header"]));
Http2\Http2ConnectionTests.cs (1)
293public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
Http2\Http2StreamTests.cs (2)
5782Assert.Equal("£", context.Request.Headers["X-Test"]); 5827Assert.Equal("£", context.Request.Headers["X-Test"]);
Http3\Http3ConnectionTests.cs (2)
145receivedHeaders = context.Request.Headers[HeaderNames.Cookie]; 828public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
RequestTests.cs (3)
2084customHeaderValue = context.Request.Headers["X-CustomHeader"]; 2201Assert.Equal("£", context.Request.Headers["X-Test"]); 2294Assert.Equal("£", context.Request.Headers["X-Test"]);
ResponseHeaderTests.cs (2)
112Assert.Equal(0, context.Response.Headers[tag].Count); 116Assert.Equal(0, context.Response.Headers[tag].Count);
InProcessWebSite (10)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (9)
467if ((string[])ctx.Request.Headers[headerName] != Array.Empty<string>()) 1067ctx.Response.WriteAsync("Scheme:" + ctx.Request.Scheme + "; Original:" + ctx.Request.Headers["x-original-proto"]); 1114File.Delete(context.Request.Headers["ANCMRHPath"]); 1122return context.Response.WriteAsync(context.Request.Headers["ANCMRHPath"]); 1146var value = context.Request.Headers["foo"]; 1153var value = context.Request.Headers["foo"]; 1166Assert.Equal("gzip, chunked", ctx.Request.Headers["Transfer-Encoding"]); 1184Assert.Equal("gzip, chunked", ctx.Request.Headers["Transfer-Encoding"]); 1187Assert.Equal("5", ctx.Request.Headers["X-Content-Length"]);
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (1)
114string key = context.Request.Headers[Constants.Headers.SecWebSocketKey].ToString();
Interop.FunctionalTests (2)
HttpClientHttp2InteropTests.cs (2)
1039Assert.Equal(oneKbString + i, context.Request.Headers["header" + i]); 1148Assert.Equal(oneKbString + i, context.Request.Headers["header" + i]);
JwtSample (1)
Startup.cs (1)
50(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
Microsoft.AspNetCore.Antiforgery (1)
Internal\DefaultAntiforgeryTokenStore.cs (1)
47requestToken = httpContext.Request.Headers[_options.HeaderName];
Microsoft.AspNetCore.Antiforgery.Test (10)
DefaultAntiforgeryTest.cs (10)
367return context.HttpContext.Response.Headers[headerName].ToString(); 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"]); 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"]; 1272Assert.Equal("public", context.HttpContext.Response.Headers["Cache-Control"]);
Microsoft.AspNetCore.CookiePolicy.Test (14)
CookieChunkingTests.cs (11)
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"]; 303Assert.Equal(8, httpContext.Response.Headers[HeaderNames.SetCookie].Count); 314}, httpContext.Response.Headers[HeaderNames.SetCookie]);
CookieConsentTests.cs (3)
582cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]); 635cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]); 680cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
Microsoft.AspNetCore.Cors.Test (9)
CorsServiceTests.cs (9)
593Assert.Equal("http://example.com", httpContext.Response.Headers["Access-Control-Allow-Origin"]); 633Assert.Equal("true", httpContext.Response.Headers["Access-Control-Allow-Credentials"]); 653Assert.Equal("Origin", httpContext.Response.Headers["Vary"]); 674Assert.Equal("Cookie,Origin", httpContext.Response.Headers["Vary"]); 735Assert.Equal("PUT", httpContext.Response.Headers["Access-Control-Allow-Methods"]); 776Assert.Equal("foo", httpContext.Response.Headers["Access-Control-Allow-Headers"]); 838Assert.Equal("foo,bar", httpContext.Response.Headers[CorsConstants.AccessControlExposeHeaders]); 858Assert.Equal("foo", httpContext.Response.Headers["Access-Control-Expose-Headers"]); 899Assert.Equal("30", httpContext.Response.Headers["Access-Control-Max-Age"]);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (3)
Latency\AddServerTimingHeaderMiddlewareTests.cs (1)
45var header = context.Response.Headers[AddServerTimingHeaderMiddleware.ServerTimingHeaderName];
Latency\RequestLatencyTelemetryMiddlewareTests.cs (2)
44var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader]; 102var header = httpContextMock.Response.Headers[TelemetryConstants.ServerApplicationNameHeader];
Microsoft.AspNetCore.Hosting (1)
Internal\HostingApplicationDiagnostics.cs (1)
401fieldValue = headers[fieldName];
Microsoft.AspNetCore.Http.Connections.Tests (7)
HttpConnectionDispatcherTests.cs (5)
820Assert.Equal("h1", connectionHttpContext.Request.Headers["header1"]); 821Assert.Equal("h2", connectionHttpContext.Request.Headers["header2"]); 822Assert.Equal("h3", connectionHttpContext.Request.Headers["header3"]); 3223(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream")) 3385(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
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 (2)
HeaderDictionaryTypeExtensions.cs (2)
171var headerValue = headers[name]; 224var values = headers[name];
Microsoft.AspNetCore.Http.Extensions.Tests (1)
ResponseExtensionTests.cs (1)
21Assert.Equal(string.Empty, context.Response.Headers["custom"].ToString());
Microsoft.AspNetCore.Http.Features (89)
IHeaderDictionary.Keyed.cs (89)
11StringValues Accept { get => this[HeaderNames.Accept]; set => this[HeaderNames.Accept] = value; } 14StringValues AcceptCharset { get => this[HeaderNames.AcceptCharset]; set => this[HeaderNames.AcceptCharset] = value; } 17StringValues AcceptEncoding { get => this[HeaderNames.AcceptEncoding]; set => this[HeaderNames.AcceptEncoding] = value; } 20StringValues AcceptLanguage { get => this[HeaderNames.AcceptLanguage]; set => this[HeaderNames.AcceptLanguage] = value; } 23StringValues AcceptRanges { get => this[HeaderNames.AcceptRanges]; set => this[HeaderNames.AcceptRanges] = value; } 26StringValues AccessControlAllowCredentials { get => this[HeaderNames.AccessControlAllowCredentials]; set => this[HeaderNames.AccessControlAllowCredentials] = value; } 29StringValues AccessControlAllowHeaders { get => this[HeaderNames.AccessControlAllowHeaders]; set => this[HeaderNames.AccessControlAllowHeaders] = value; } 32StringValues AccessControlAllowMethods { get => this[HeaderNames.AccessControlAllowMethods]; set => this[HeaderNames.AccessControlAllowMethods] = value; } 35StringValues AccessControlAllowOrigin { get => this[HeaderNames.AccessControlAllowOrigin]; set => this[HeaderNames.AccessControlAllowOrigin] = value; } 38StringValues AccessControlExposeHeaders { get => this[HeaderNames.AccessControlExposeHeaders]; set => this[HeaderNames.AccessControlExposeHeaders] = value; } 41StringValues AccessControlMaxAge { get => this[HeaderNames.AccessControlMaxAge]; set => this[HeaderNames.AccessControlMaxAge] = value; } 44StringValues AccessControlRequestHeaders { get => this[HeaderNames.AccessControlRequestHeaders]; set => this[HeaderNames.AccessControlRequestHeaders] = value; } 47StringValues AccessControlRequestMethod { get => this[HeaderNames.AccessControlRequestMethod]; set => this[HeaderNames.AccessControlRequestMethod] = value; } 50StringValues Age { get => this[HeaderNames.Age]; set => this[HeaderNames.Age] = value; } 53StringValues Allow { get => this[HeaderNames.Allow]; set => this[HeaderNames.Allow] = value; } 56StringValues AltSvc { get => this[HeaderNames.AltSvc]; set => this[HeaderNames.AltSvc] = value; } 59StringValues Authorization { get => this[HeaderNames.Authorization]; set => this[HeaderNames.Authorization] = value; } 62StringValues Baggage { get => this[HeaderNames.Baggage]; set => this[HeaderNames.Baggage] = value; } 65StringValues CacheControl { get => this[HeaderNames.CacheControl]; set => this[HeaderNames.CacheControl] = value; } 68StringValues Connection { get => this[HeaderNames.Connection]; set => this[HeaderNames.Connection] = value; } 71StringValues ContentDisposition { get => this[HeaderNames.ContentDisposition]; set => this[HeaderNames.ContentDisposition] = value; } 74StringValues ContentEncoding { get => this[HeaderNames.ContentEncoding]; set => this[HeaderNames.ContentEncoding] = value; } 77StringValues ContentLanguage { get => this[HeaderNames.ContentLanguage]; set => this[HeaderNames.ContentLanguage] = value; } 80StringValues ContentLocation { get => this[HeaderNames.ContentLocation]; set => this[HeaderNames.ContentLocation] = value; } 83StringValues ContentMD5 { get => this[HeaderNames.ContentMD5]; set => this[HeaderNames.ContentMD5] = value; } 86StringValues ContentRange { get => this[HeaderNames.ContentRange]; set => this[HeaderNames.ContentRange] = value; } 89StringValues ContentSecurityPolicy { get => this[HeaderNames.ContentSecurityPolicy]; set => this[HeaderNames.ContentSecurityPolicy] = value; } 92StringValues ContentSecurityPolicyReportOnly { get => this[HeaderNames.ContentSecurityPolicyReportOnly]; set => this[HeaderNames.ContentSecurityPolicyReportOnly] = value; } 95StringValues ContentType { get => this[HeaderNames.ContentType]; set => this[HeaderNames.ContentType] = value; } 98StringValues CorrelationContext { get => this[HeaderNames.CorrelationContext]; set => this[HeaderNames.CorrelationContext] = value; } 101StringValues Cookie { get => this[HeaderNames.Cookie]; set => this[HeaderNames.Cookie] = value; } 104StringValues Date { get => this[HeaderNames.Date]; set => this[HeaderNames.Date] = value; } 107StringValues ETag { get => this[HeaderNames.ETag]; set => this[HeaderNames.ETag] = value; } 110StringValues Expires { get => this[HeaderNames.Expires]; set => this[HeaderNames.Expires] = value; } 113StringValues Expect { get => this[HeaderNames.Expect]; set => this[HeaderNames.Expect] = value; } 116StringValues From { get => this[HeaderNames.From]; set => this[HeaderNames.From] = value; } 119StringValues GrpcAcceptEncoding { get => this[HeaderNames.GrpcAcceptEncoding]; set => this[HeaderNames.GrpcAcceptEncoding] = value; } 122StringValues GrpcEncoding { get => this[HeaderNames.GrpcEncoding]; set => this[HeaderNames.GrpcEncoding] = value; } 125StringValues GrpcMessage { get => this[HeaderNames.GrpcMessage]; set => this[HeaderNames.GrpcMessage] = value; } 128StringValues GrpcStatus { get => this[HeaderNames.GrpcStatus]; set => this[HeaderNames.GrpcStatus] = value; } 131StringValues GrpcTimeout { get => this[HeaderNames.GrpcTimeout]; set => this[HeaderNames.GrpcTimeout] = value; } 134StringValues Host { get => this[HeaderNames.Host]; set => this[HeaderNames.Host] = value; } 137StringValues KeepAlive { get => this[HeaderNames.KeepAlive]; set => this[HeaderNames.KeepAlive] = value; } 140StringValues IfMatch { get => this[HeaderNames.IfMatch]; set => this[HeaderNames.IfMatch] = value; } 143StringValues IfModifiedSince { get => this[HeaderNames.IfModifiedSince]; set => this[HeaderNames.IfModifiedSince] = value; } 146StringValues IfNoneMatch { get => this[HeaderNames.IfNoneMatch]; set => this[HeaderNames.IfNoneMatch] = value; } 149StringValues IfRange { get => this[HeaderNames.IfRange]; set => this[HeaderNames.IfRange] = value; } 152StringValues IfUnmodifiedSince { get => this[HeaderNames.IfUnmodifiedSince]; set => this[HeaderNames.IfUnmodifiedSince] = value; } 155StringValues LastModified { get => this[HeaderNames.LastModified]; set => this[HeaderNames.LastModified] = value; } 158StringValues Link { get => this[HeaderNames.Link]; set => this[HeaderNames.Link] = value; } 161StringValues Location { get => this[HeaderNames.Location]; set => this[HeaderNames.Location] = value; } 164StringValues MaxForwards { get => this[HeaderNames.MaxForwards]; set => this[HeaderNames.MaxForwards] = value; } 167StringValues Origin { get => this[HeaderNames.Origin]; set => this[HeaderNames.Origin] = value; } 170StringValues Pragma { get => this[HeaderNames.Pragma]; set => this[HeaderNames.Pragma] = value; } 173StringValues ProxyAuthenticate { get => this[HeaderNames.ProxyAuthenticate]; set => this[HeaderNames.ProxyAuthenticate] = value; } 176StringValues ProxyAuthorization { get => this[HeaderNames.ProxyAuthorization]; set => this[HeaderNames.ProxyAuthorization] = value; } 179StringValues ProxyConnection { get => this[HeaderNames.ProxyConnection]; set => this[HeaderNames.ProxyConnection] = value; } 182StringValues Range { get => this[HeaderNames.Range]; set => this[HeaderNames.Range] = value; } 185StringValues Referer { get => this[HeaderNames.Referer]; set => this[HeaderNames.Referer] = value; } 188StringValues RetryAfter { get => this[HeaderNames.RetryAfter]; set => this[HeaderNames.RetryAfter] = value; } 191StringValues RequestId { get => this[HeaderNames.RequestId]; set => this[HeaderNames.RequestId] = value; } 194StringValues SecWebSocketAccept { get => this[HeaderNames.SecWebSocketAccept]; set => this[HeaderNames.SecWebSocketAccept] = value; } 197StringValues SecWebSocketKey { get => this[HeaderNames.SecWebSocketKey]; set => this[HeaderNames.SecWebSocketKey] = value; } 200StringValues SecWebSocketProtocol { get => this[HeaderNames.SecWebSocketProtocol]; set => this[HeaderNames.SecWebSocketProtocol] = value; } 203StringValues SecWebSocketVersion { get => this[HeaderNames.SecWebSocketVersion]; set => this[HeaderNames.SecWebSocketVersion] = value; } 206StringValues SecWebSocketExtensions { get => this[HeaderNames.SecWebSocketExtensions]; set => this[HeaderNames.SecWebSocketExtensions] = value; } 209StringValues Server { get => this[HeaderNames.Server]; set => this[HeaderNames.Server] = value; } 212StringValues SetCookie { get => this[HeaderNames.SetCookie]; set => this[HeaderNames.SetCookie] = value; } 215StringValues StrictTransportSecurity { get => this[HeaderNames.StrictTransportSecurity]; set => this[HeaderNames.StrictTransportSecurity] = value; } 218StringValues TE { get => this[HeaderNames.TE]; set => this[HeaderNames.TE] = value; } 221StringValues Trailer { get => this[HeaderNames.Trailer]; set => this[HeaderNames.Trailer] = value; } 224StringValues TransferEncoding { get => this[HeaderNames.TransferEncoding]; set => this[HeaderNames.TransferEncoding] = value; } 227StringValues Translate { get => this[HeaderNames.Translate]; set => this[HeaderNames.Translate] = value; } 230StringValues TraceParent { get => this[HeaderNames.TraceParent]; set => this[HeaderNames.TraceParent] = value; } 233StringValues TraceState { get => this[HeaderNames.TraceState]; set => this[HeaderNames.TraceState] = value; } 236StringValues Upgrade { get => this[HeaderNames.Upgrade]; set => this[HeaderNames.Upgrade] = value; } 239StringValues UpgradeInsecureRequests { get => this[HeaderNames.UpgradeInsecureRequests]; set => this[HeaderNames.UpgradeInsecureRequests] = value; } 242StringValues UserAgent { get => this[HeaderNames.UserAgent]; set => this[HeaderNames.UserAgent] = value; } 245StringValues Vary { get => this[HeaderNames.Vary]; set => this[HeaderNames.Vary] = value; } 248StringValues Via { get => this[HeaderNames.Via]; set => this[HeaderNames.Via] = value; } 251StringValues Warning { get => this[HeaderNames.Warning]; set => this[HeaderNames.Warning] = value; } 254StringValues WebSocketSubProtocols { get => this[HeaderNames.WebSocketSubProtocols]; set => this[HeaderNames.WebSocketSubProtocols] = value; } 257StringValues WWWAuthenticate { get => this[HeaderNames.WWWAuthenticate]; set => this[HeaderNames.WWWAuthenticate] = value; } 260StringValues XContentTypeOptions { get => this[HeaderNames.XContentTypeOptions]; set => this[HeaderNames.XContentTypeOptions] = value; } 263StringValues XFrameOptions { get => this[HeaderNames.XFrameOptions]; set => this[HeaderNames.XFrameOptions] = value; } 266StringValues XPoweredBy { get => this[HeaderNames.XPoweredBy]; set => this[HeaderNames.XPoweredBy] = value; } 269StringValues XRequestedWith { get => this[HeaderNames.XRequestedWith]; set => this[HeaderNames.XRequestedWith] = value; } 272StringValues XUACompatible { get => this[HeaderNames.XUACompatible]; set => this[HeaderNames.XUACompatible] = value; } 275StringValues XXSSProtection { get => this[HeaderNames.XXSSProtection]; set => this[HeaderNames.XXSSProtection] = value; }
Microsoft.AspNetCore.Http.Results.Tests (13)
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 (2)
58Assert.Equal(location, httpContext.Response.Headers["Location"]); 75Assert.Equal(location, httpContext.Response.Headers["Location"]);
CreatedResultTests.cs (2)
43Assert.Equal(location, httpContext.Response.Headers["Location"]); 60Assert.Equal(location, httpContext.Response.Headers["Location"]);
RedirectToRouteResultTests.cs (3)
48Assert.Equal(locationUrl, httpContext.Response.Headers["Location"]); 66Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 84Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
Microsoft.AspNetCore.Http.Tests (4)
HeaderDictionaryTests.cs (1)
129Assert.Same(Array.Empty<string>(), (string[])asIHeaderDictionary["Header1"]);
Internal\DefaultHttpRequestTests.cs (3)
167var cookieHeaders = request.Headers["Cookie"]; 183Assert.Equal(newCookies, request.Headers["Cookie"]); 192cookieHeaders = request.Headers["Cookie"];
Microsoft.AspNetCore.HttpOverrides (2)
CertificateForwardingMiddleware.cs (1)
49var header = httpContext.Request.Headers[_options.CertificateHeader];
HttpMethodOverrideMiddleware.cs (1)
49var xHttpMethodOverrideValue = context.Request.Headers[xHttpMethodOverride];
Microsoft.AspNetCore.HttpOverrides.Tests (7)
ForwardedHeadersMiddlewareTest.cs (7)
85Assert.Equal(header, context.Request.Headers["X-Forwarded-For"]); 141Assert.Equal(remainingHeader, context.Request.Headers["X-Forwarded-For"].ToString()); 183context.Request.Headers["X-Original-For"]); 1085Assert.Equal(remainingHeader, context.Request.Headers["X-Forwarded-Proto"].ToString()); 1122Assert.Equal(remainingHeader, context.Request.Headers["X-Forwarded-Proto"].ToString()); 1204Assert.Equal(expectedOriginalPrefix, context.Request.Headers["X-Original-Prefix"]); 1328Assert.Equal(expectedforwardedPrefix, context.Request.Headers["X-Forwarded-Prefix"].ToString());
Microsoft.AspNetCore.Mvc.Core (2)
ModelBinding\Binders\HeaderModelBinder.cs (2)
130var value = request.Headers[headerName]; 157request.Headers[headerName]);
Microsoft.AspNetCore.Mvc.Core.Test (32)
AcceptedAtActionResultTests.cs (1)
168Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedAtRouteResultTests.cs (1)
119Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
AcceptedResultTests.cs (2)
81Assert.Equal(location, httpContext.Response.Headers["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 (3)
75Assert.Equal(location, httpContext.Response.Headers["Location"]); 91Assert.Equal(0, httpContext.Response.Headers["Location"].Count); 109Assert.Equal(location, httpContext.Response.Headers["Location"]);
FileResultHelperTest.cs (5)
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"]);
Filters\MiddlewareFilterTest.cs (2)
101httpContext.Response.Headers["h1"] = httpContext.Response.Headers["h1"] + "-pipeline2"; 127Assert.Equal(expectedHeaderValue, response.Headers[expectedHeader]);
Filters\ResponseCacheFilterExecutorTest.cs (11)
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"]); 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"]);
RedirectToActionResultTest.cs (2)
108Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 136Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
RedirectToRouteResultTest.cs (3)
112Assert.Equal(locationUrl, httpContext.Response.Headers["Location"]); 137Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]); 162Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
Microsoft.AspNetCore.Mvc.Cors (2)
CorsAuthorizationFilter.cs (1)
90httpContext.Request.Headers[CorsConstants.AccessControlRequestMethod];
DisableCorsAuthorizationFilter.cs (1)
27context.HttpContext.Request.Headers[CorsConstants.AccessControlRequestMethod];
Microsoft.AspNetCore.Mvc.Cors.Test (8)
CorsAuthorizationFilterTest.cs (8)
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]); 92Assert.Equal("http://example.com", response.Headers[CorsConstants.AccessControlAllowOrigin]); 93Assert.Equal("exposed1,exposed2", response.Headers[CorsConstants.AccessControlExposeHeaders]);
Microsoft.AspNetCore.Mvc.TagHelpers (1)
Cache\CacheTagKey.cs (1)
22private static readonly Func<IHeaderDictionary, string, string> HeaderAccessor = (c, key) => c[key];
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
CookieTempDataProviderTest.cs (1)
90var setCookieHeader = SetCookieHeaderValue.Parse(context.Response.Headers["Set-Cookie"].ToString());
Microsoft.AspNetCore.OutputCaching.Tests (1)
OutputCacheMiddlewareTests.cs (1)
119Assert.Equal("NewValue", context.HttpContext.Response.Headers["MyHeader"]);
Microsoft.AspNetCore.Owin.Tests (2)
OwinEnvironmentTests.cs (2)
86Assert.Equal("CustomRequestValue", context.Request.Headers["CustomRequestHeader"]); 94Assert.Equal("CustomResponseValue", context.Response.Headers["CustomResponseHeader"]);
Microsoft.AspNetCore.ResponseCaching (1)
ResponseCachingKeyProvider.cs (1)
110var headerValues = requestHeaders[header];
Microsoft.AspNetCore.Rewrite (1)
PatternSegments\HeaderSegment.cs (1)
17return context.HttpContext.Request.Headers[_header];
Microsoft.AspNetCore.Routing (2)
Matching\ContentEncodingNegotiationMatcherPolicy.cs (1)
17private protected override StringValues GetNegotiationHeader(HttpContext httpContext) => httpContext.Request.Headers[HeaderName];
Matching\NegotiationMatcherPolicy.cs (1)
402var header = httpContext.Request.Headers[_negotiationHeader];
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.Server.HttpSys (1)
RequestProcessing\Request.cs (1)
520headerDictionary.Add("X-Content-Length", headerDictionary[HeaderNames.ContentLength]);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (16)
RequestBodyTests.cs (2)
270Assert.Equal("", httpContext.Request.Headers[HeaderNames.ContentLength].ToString()); 282Assert.Equal("", httpContext.Request.Headers["Custom-Header"].ToString());
RequestHeaderTests.cs (14)
28Assert.False(StringValues.IsNullOrEmpty(requestHeaders["Host"])); 29Assert.True(StringValues.IsNullOrEmpty(requestHeaders["Accept"])); 45Assert.False(StringValues.IsNullOrEmpty(requestHeaders["Host"])); 46Assert.Equal("close", requestHeaders["Connection"]); 48Assert.Single(requestHeaders["Custom-Header"]); 49Assert.Equal("custom1, and custom2, custom3", requestHeaders["Custom-Header"]); 50Assert.Single(requestHeaders["Spacer-Header"]); 51Assert.Equal("spacervalue, spacervalue", requestHeaders["Spacer-Header"]); 110Assert.Single(requestHeaders["Transfer-Encoding"]); 133Assert.Single(requestHeaders["Transfer-Encoding"]); 156Assert.Single(requestHeaders["Transfer-Encoding"]); 165Assert.Single(requestHeaders["X-Content-Length"]); 166Assert.Equal("1", requestHeaders["X-Content-Length"]); 191Assert.Contains(requestHeaders[customHeader].First(), requestHeaders.Keys);
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpContext.cs (1)
385RequestHeaders.Add("X-Content-Length", RequestHeaders[HeaderNames.ContentLength]);
Microsoft.AspNetCore.Server.IISIntegration (4)
IISMiddleware.cs (4)
103if (!string.Equals(_pairingToken, httpContext.Request.Headers[MSAspNetCoreToken], StringComparison.Ordinal)) 113string.Equals(ANCMShutdownEventHeaderValue, httpContext.Request.Headers[MSAspNetCoreEvent], StringComparison.OrdinalIgnoreCase)) 137var header = httpContext.Request.Headers[MSAspNetCoreClientCert]; 172var tokenHeader = context.Request.Headers[MSAspNetCoreWinAuthToken];
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\Http\Http1MessageBody.cs (1)
185headerDictionary.Add("X-Content-Length", headerDictionary[HeaderNames.ContentLength]);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (4)
Http1\Http1ConnectionTests.cs (1)
1198public StringValues this[string key] { get => _innerHeaders[key]; set => _innerHeaders[key] = value; }
HttpRequestHeadersTests.cs (3)
109Assert.Same(Array.Empty<string>(), (string[])headers["custom"]); 110Assert.Same(Array.Empty<string>(), (string[])headers["host"]); 111Assert.Same(Array.Empty<string>(), (string[])headers["Content-Length"]);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
HeaderCollectionBenchmark.cs (1)
227value = _response.Headers[HeaderNames.ContentLength];
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Hubs.cs (1)
73return headerNames.Select(h => (string)headers[h]);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Startup.cs (1)
44var userNameHeader = connection.GetHttpContext().Request.Headers["UserName"];
Microsoft.AspNetCore.SignalR.Tests (1)
Startup.cs (1)
59(context.HttpContext.WebSockets.IsWebSocketRequest || context.Request.Headers["Accept"] == "text/event-stream"))
Microsoft.AspNetCore.TestHost.Tests (9)
ClientHandlerTests.cs (2)
37Assert.Equal("example.com", features.Get<IHttpRequestFeature>().Headers["host"]); 88Assert.Equal("example.com", features.Get<IHttpRequestFeature>().Headers["host"]);
HttpContextBuilderTests.cs (7)
91Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 137Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 161Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 185Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 207Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 256Assert.Equal("TestValue", context.Response.Headers["TestHeader"]); 297Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
Microsoft.AspNetCore.WebSockets.Tests (1)
WebSocketMiddlewareTests.cs (1)
40Assert.Equal("alpha, bravo, charlie", context.Request.Headers["Sec-WebSocket-Protocol"]);
NativeIISSample (1)
Startup.cs (1)
41await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
OpenIdConnectSample (1)
Startup.cs (1)
34var userAgent = httpContext.Request.Headers["User-Agent"].ToString();
SignalR.Client.FunctionalTestApp (3)
Startup.cs (1)
77string token = request.Headers["Authorization"];
TestHub.cs (2)
134return Context.GetHttpContext().Request.Headers["Content-Type"]; 139return Context.GetHttpContext().Request.Headers[headerName];
StatusCodePagesSample (1)
Startup.cs (1)
68var referrer = context.Request.Headers["referer"];
WebPubSubWeb (1)
Program.cs (1)
67var userId = context.Request.Headers["ce-userId"];