5 writes to Headers
Microsoft.DotNet.Internal.SymbolHelper (4)
SymbolPromotionHelper.cs (3)
148Headers = 202Headers = 265Headers =
SymbolUploadHelperFactory.cs (1)
150using HttpRequestMessage getToolRequest = new(HttpMethod.Get, downloadUri) { Headers = { Accept = { new ("application/zip") } } };
Microsoft.Extensions.Logging.AzureAppServices (1)
BlobAppendReferenceWrapper.cs (1)
53Headers =
613 references to Headers
Aspire.Dashboard.Tests (19)
Integration\OtlpCorsHttpServiceTests.cs (15)
31preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Method", "POST"); 32preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Headers", "x-requested-with,x-custom,Content-Type"); 33preflightRequest.Headers.TryAddWithoutValidation("Origin", "http://localhost:8000"); 56preflightRequest1.Headers.TryAddWithoutValidation("Access-Control-Request-Method", "POST"); 57preflightRequest1.Headers.TryAddWithoutValidation("Access-Control-Request-Headers", "x-requested-with,x-custom,Content-Type"); 58preflightRequest1.Headers.TryAddWithoutValidation("Origin", "http://localhost:8000"); 70preflightRequest2.Headers.TryAddWithoutValidation("Access-Control-Request-Method", "POST"); 71preflightRequest2.Headers.TryAddWithoutValidation("Access-Control-Request-Headers", "x-requested-with,x-custom,Content-Type"); 72preflightRequest2.Headers.TryAddWithoutValidation("Origin", "http://localhost:8001"); 96preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Method", "POST"); 97preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Headers", "x-requested-with,x-custom,Content-Type"); 98preflightRequest.Headers.TryAddWithoutValidation("Origin", "http://localhost:8001"); 124preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Method", "POST"); 125preflightRequest.Headers.TryAddWithoutValidation("Access-Control-Request-Headers", "x-requested-with,x-custom,Content-Type"); 126preflightRequest.Headers.TryAddWithoutValidation("Origin", "http://localhost:8000");
Integration\OtlpHttpServiceTests.cs (2)
142requestMessage.Headers.TryAddWithoutValidation(OtlpApiKeyAuthenticationHandler.ApiKeyHeaderName, "WRONG"); 170requestMessage.Headers.TryAddWithoutValidation(OtlpApiKeyAuthenticationHandler.ApiKeyHeaderName, apiKey);
Integration\ResponseCompressionTests.cs (2)
27request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("br")); 49request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("br"));
AuthSamples.FunctionalTests (1)
HttpClientExtensions.cs (1)
54if (!submision.Headers.TryAddWithoutValidation(header.Key, header.Value))
Binding.ReliableSession.IntegrationTests (2)
NetHttpBindingTests.cs (1)
284if (request.Headers.Contains(secondRequestHeaderName))
WSHttpBindingTests.cs (1)
284if (request.Headers.Contains(secondRequestHeaderName))
Diagnostics.FunctionalTests (5)
DeveloperExceptionPageSampleTest.cs (1)
42request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
ProblemDetailsExceptionHandlerSampleTest.cs (2)
27request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 44request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
StatusCodeSampleTest.cs (2)
61request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain")); 82request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
dotnet-svcutil-lib (17)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (15)
597requestMessage.Headers.TransferEncodingChunked = true; 600requestMessage.Headers.CacheControl = s_requestCacheHeader; 1062_httpRequestMessage.Headers.Accept.TryParseAdd(value); 1068_httpRequestMessage.Headers.ConnectionClose = false; 1072_httpRequestMessage.Headers.Connection.TryParseAdd(value); 1102_httpRequestMessage.Headers.ExpectContinue = true; 1106_httpRequestMessage.Headers.Expect.TryParseAdd(value); 1117_httpRequestMessage.Headers.Referrer = new Uri(value); 1123_httpRequestMessage.Headers.TransferEncodingChunked = true; 1127_httpRequestMessage.Headers.TransferEncoding.TryParseAdd(value); 1132_httpRequestMessage.Headers.UserAgent.Add(ProductInfoHeaderValue.Parse(value)); 1139_httpRequestMessage.Headers.IfModifiedSince = modifiedSinceDate; 1163_httpRequestMessage.Headers.Add(name, value); 1182_httpRequestMessage.Headers.TryAddWithoutValidation("SOAPAction", action); 1200_httpRequestMessage.Headers.TransferEncodingChunked = false;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageExtensionMethods.cs (2)
84MergeWebHeaderCollectionWithHttpHeaders(headersToMerge, requestMessage.Headers, requestMessage.Content.Headers); 104IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers = httpRequest.Headers;
HeaderPropagationSample (1)
Startup.cs (1)
79foreach (var header in response.RequestMessage.Headers)
HttpStress (1)
Program.cs (1)
287req.Headers.ExpectContinue = true;
IIS.FunctionalTests (5)
src\Servers\IIS\IIS\test\Common.FunctionalTests\BasicAuthTests.cs (1)
62request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Latin1Tests.cs (2)
49requestMessage.Headers.Add("foo", "£"); 67requestMessage.Headers.Add("foo", "£");
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (2)
129request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); 147request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
IISExpress.FunctionalTests (5)
src\Servers\IIS\IIS\test\Common.FunctionalTests\BasicAuthTests.cs (1)
62request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Latin1Tests.cs (2)
49requestMessage.Headers.Add("foo", "£"); 67requestMessage.Headers.Add("foo", "£");
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (2)
129request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); 147request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
Interop.FunctionalTests (16)
Http2\Http2RequestTests.cs (1)
293request.Headers.Host = "localhost2";
Http3\Http3RequestTests.cs (6)
728request.Headers.ExpectContinue = true; 912request1.Headers.Add("id", "1"); 925request2.Headers.Add("id", "2"); 941request3.Headers.Add("id", "3"); 1489request1.Headers.TryAddWithoutValidation("User-Agent", "TestUserAgent"); 1500request2.Headers.TryAddWithoutValidation("User-Agent", "TestUserAgent");
Http3\Http3TlsTests.cs (3)
59request.Headers.Host = "testhost"; 325request.Headers.Host = "testhost"; 476request.Headers.Host = "testhost";
HttpClientHttp2InteropTests.cs (6)
1060request.Headers.Add("header" + i, oneKbString + i); 1062request.Headers.Host = "localhost"; // The default Host header has a random port value which can cause the length to vary. 1169request.Headers.Add("header" + i, oneKbString + i); 1171request.Headers.Host = "localhost"; // The default Host has a random port value that causes the length to very. 1368request.Headers.Add("header" + i, oneKbString + i); 1567request.Headers.Host = "xn--md7a.xn--c1y"; // Punycode
Keycloak.Web (1)
AuthorizationHandler.cs (1)
17request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
Microsoft.AspNetCore.Authentication.Google (1)
GoogleHandler.cs (1)
48request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokens.AccessToken);
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
MicrosoftAccountHandler.cs (1)
44request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokens.AccessToken);
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthHandler.cs (1)
219requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
OpenIdConnectHandler.cs (1)
1058requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", message.AccessToken);
Microsoft.AspNetCore.Authentication.Test (11)
CookieTests.cs (1)
1908request.Headers.Add("Cookie", cookieHeader);
JwtBearerTests.cs (1)
1253request.Headers.Add("Authorization", authorizationHeader);
JwtBearerTests_Handler.cs (1)
1320request.Headers.Add("Authorization", authorizationHeader);
OpenIdConnect\TestServerExtensions.cs (1)
26request.Headers.Add("Cookie", cookieHeader);
TestExtensions.cs (1)
23request.Headers.Add("Cookie", cookieHeader);
TwitterTests.cs (4)
219request.Headers.Add(HeaderNames.Cookie, cookie.ToString()); 269request.Headers.Add(HeaderNames.Cookie, cookie.ToString()); 376request.Headers.Add(HeaderNames.Cookie, cookie.ToString()); 483finalAuthorizationParameter = req.Headers.Authorization.Parameter;
WsFederation\WsFederationTest.cs (1)
269request.Headers.Add(HeaderNames.Cookie, new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
WsFederation\WsFederationTest_Handler.cs (1)
267request.Headers.Add(HeaderNames.Cookie, new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
Microsoft.AspNetCore.Authentication.Twitter (2)
TwitterHandler.cs (2)
255request.Headers.Add("Authorization", stringBuilder.ToString()); 259request.Headers.Add("Accept", "application/json");
Microsoft.AspNetCore.CookiePolicy.Test (1)
TestExtensions.cs (1)
20request.Headers.Add("Cookie", cookieHeader);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (2)
Logging\AcceptanceTests.cs (2)
297request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json)); 357httpMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json));
Microsoft.AspNetCore.Diagnostics.Tests (4)
DeveloperExceptionPageMiddlewareTest.cs (3)
63request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 116request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 175request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
ExceptionHandlerMiddlewareTest.cs (1)
69request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Microsoft.AspNetCore.HeaderPropagation (3)
HeaderPropagationMessageHandler.cs (3)
61if (!request.Headers.TryGetValues(entry.OutboundHeaderName, out var _) && 70if (!request.Headers.TryAddWithoutValidation(entry.OutboundHeaderName, value) && hasContent) 78if (!request.Headers.TryAddWithoutValidation(entry.OutboundHeaderName, values) && hasContent)
Microsoft.AspNetCore.HeaderPropagation.Tests (7)
HeaderPropagationIntegrationTest.cs (5)
110request.Headers.Add("in", "test"); 136request.Headers.Add("first", "value"); 137request.Headers.Add("second", "other"); 183request.Headers.Add("in", "test"); 234Headers = request.Headers;
HeaderPropagationMessageHandlerTest.cs (2)
198request.Headers.Add("inout", outgoingValue); 267Headers = request.Headers;
Microsoft.AspNetCore.Http.Connections.Client (6)
HttpConnection.cs (1)
479request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
Internal\AccessTokenHttpMessageHandler.cs (1)
63request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
Internal\LongPollingTransport.cs (2)
55request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*")); 155request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
Internal\SendUtils.cs (1)
44request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
Internal\ServerSentEventsTransport.cs (1)
56request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream"));
Microsoft.AspNetCore.HttpLogging.Tests (3)
HttpLoggingMiddlewareTests.cs (3)
1803request.Headers.TryAddWithoutValidation("Accept", "application/json"); 1893request.Headers.TryAddWithoutValidation("Accept", "application/json"); 1939request.Headers.TryAddWithoutValidation("Accept", "application/json");
Microsoft.AspNetCore.HttpOverrides.Tests (1)
HttpMethodOverrideMiddlewareTest.cs (1)
40req.Headers.Add("X-Http-Method-Override", "DELETE");
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Extensions\HttpClientExtensions.cs (1)
56submision.Headers.TryAddWithoutValidation(header.Key, header.Value);
Microsoft.AspNetCore.Identity.InMemory.Test (2)
FunctionalTest.cs (2)
433request.Headers.Add("Cookie", cookieHeader); 437request.Headers.Add(HeaderNames.XRequestedWith, "XMLHttpRequest");
Microsoft.AspNetCore.Localization.FunctionalTests (2)
LocalizationSampleTest.cs (1)
34request.Headers.Add("Cookie", $"{CookieRequestCultureProvider.DefaultCookieName}={cookieValue}");
LocalizationTest.cs (1)
113request.Headers.Add("Cookie", $"{CookieRequestCultureProvider.DefaultCookieName}={cookieValue}");
Microsoft.AspNetCore.Mvc.FunctionalTests (197)
AntiforgeryMiddlewareTest.cs (4)
41request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 125request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 157request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 189request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken);
AntiforgeryTests.cs (2)
68request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); 118request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value);
ApplicationModelTest.cs (1)
127request.Headers.Add("helloWorld", "HelloWorld");
AsyncEnumerableTestBase.cs (1)
76request.Headers.Add("Accept", "application/xml");
AuthMiddlewareAndFilterTestBase.cs (14)
57request.Headers.Add("Cookie", authCookie); 75request.Headers.Add("Cookie", authCookie); 82request.Headers.Add("Cookie", authCookie); 121request.Headers.Add("Cookie", authCookie); 137request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); 156request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); 171request.Headers.Add("Cookie", cookie); 190request.Headers.Add("Cookie", cookie); 205request.Headers.Add("Cookie", cookie); 210request.Headers.Add("Cookie", cookie); 217request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); 218request.Headers.Add("Cookie", cookie); 252request.Headers.Add("Cookie", authCookie); 259request.Headers.Add("Cookie", authCookie);
AuthMiddlewareUsingRequireAuthTest.cs (2)
48request.Headers.Add("Cookie", authCookie); 67request.Headers.Add("Cookie", authCookie);
ContentNegotiationTest.cs (12)
110request.Headers.TryAddWithoutValidation("Accept", acceptHeader); 129request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 154request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); 347request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); 348request.Headers.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); 368request.Headers.Accept.ParseAdd(acceptMediaType); 386request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); 405request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/custom1")); 421request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/custom1")); 436request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); 490request.Headers.Add("Accept", "application/vnd.example.contact+json; v=2"); 508request.Headers.Add("Accept", "application/vnd.example.contact+xml; v=2");
ControllerFromServicesTests.cs (1)
36request.Headers.TryAddWithoutValidation("Test-Header", "test-header-value");
CorsTests.cs (2)
17request.Headers.Add(CorsConstants.Origin, "http://example.com"); 18request.Headers.Add(CorsConstants.AccessControlRequestMethod, "POST");
CorsTestsBase.cs (30)
45request.Headers.Add(CorsConstants.Origin, origin); 81request.Headers.Add(CorsConstants.Origin, "http://example.com"); 82request.Headers.Add(CorsConstants.AccessControlRequestMethod, "POST"); 99request.Headers.Add(CorsConstants.Origin, "http://example.com"); 100request.Headers.Add(CorsConstants.AccessControlRequestMethod, "POST"); 122request.Headers.Add(CorsConstants.Origin, "http://example.com"); 123request.Headers.Add(CorsConstants.AccessControlRequestMethod, method); 124request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); 159request.Headers.Add(CorsConstants.Origin, "http://example.com"); 160request.Headers.Add(CorsConstants.AccessControlExposeHeaders, "exposed1,exposed2"); 191request.Headers.Add(CorsConstants.Origin, "http://example.com"); 192request.Headers.Add(CorsConstants.AccessControlRequestMethod, "PUT"); 193request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "header1,header2"); 225request.Headers.Add(CorsConstants.Origin, "http://example2.com"); 250request.Headers.Add(CorsConstants.Origin, "http://example.com"); 276request.Headers.Add(CorsConstants.Origin, "http://example.com"); 277request.Headers.Add(CorsConstants.AccessControlRequestMethod, method); 278request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); 301request.Headers.Add(CorsConstants.Origin, "http://example.com"); 302request.Headers.Add(CorsConstants.AccessControlRequestMethod, "GET"); 303request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); 333request.Headers.Add(CorsConstants.Origin, "http://example.com"); 334request.Headers.Add(CorsConstants.AccessControlRequestMethod, "GET"); 335request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); 372request.Headers.Add(CorsConstants.Origin, "http://example.com"); 373request.Headers.Add(CorsConstants.AccessControlRequestMethod, "GET"); 374request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); 395request.Headers.Add(CorsConstants.Origin, "http://notexpecteddomain.com"); 396request.Headers.Add(CorsConstants.AccessControlRequestMethod, "GET"); 397request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom");
DoNotRespectBrowserAcceptHeaderTests.cs (1)
149request.Headers.Add("Accept", accept);
FileResultTests.cs (43)
60httpRequestMessage.Headers.Range = new RangeHeaderValue(start, end); 82httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 102httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 124httpRequestMessage.Headers.Range = new RangeHeaderValue(start, end); 146httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 166httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 210httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 228httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 229httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 248httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 249httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"NotEtag\"")); 280httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 281httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 347httpRequestMessage.Headers.Range = new RangeHeaderValue(start, end); 369httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 389httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 431httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 449httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 450httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 469httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 470httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"NotEtag\"")); 499httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 500httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 548httpRequestMessage.Headers.Range = new RangeHeaderValue(start, end); 570httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 590httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 635httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 653httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 654httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 673httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 674httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"NotEtag\"")); 705httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 706httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 761httpRequestMessage.Headers.Range = new RangeHeaderValue(start, end); 785httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 803httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 804httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\"")); 826httpRequestMessage.Headers.Range = new RangeHeaderValue(0, 6); 827httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"NotEtag\"")); 851httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 874httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 909httpRequestMessage.Headers.TryAddWithoutValidation("Range", rangeString); 910httpRequestMessage.Headers.IfRange = new RangeConditionHeaderValue(new EntityTagHeaderValue("\"Etag\""));
GlobalAuthorizationFilterTestBase.cs (1)
73request.Headers.Add("Cookie", cookie2);
HtmlGenerationTest.cs (2)
505request.Headers.Add("Cookie", "CartId=10"); 807request.Headers.Add("Locale", locale);
JsonInputFormatterTestBase.cs (1)
224request.Headers.TransferEncodingChunked = true;
JsonOutputFormatterTestBase.cs (1)
52request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
JsonResultWithNewtonsoftJsonTest.cs (1)
65request.Headers.TryAddWithoutValidation("Accept", mediaType);
JsonResultWithSystemTextJsonTest.cs (1)
65request.Headers.TryAddWithoutValidation("Accept", mediaType);
NonNullableReferenceTypesTest.cs (2)
53request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); 95request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value);
RazorPageModelTest.cs (2)
195request.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 196request.Headers.Add("RequestVerificationToken", formToken);
RazorPagesTest.cs (18)
102postRequest.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 103postRequest.Headers.Add("RequestVerificationToken", formToken); 134postRequest.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 135postRequest.Headers.Add("RequestVerificationToken", formToken); 215postRequest.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 216postRequest.Headers.Add("RequestVerificationToken", formToken); 247postRequest.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 248postRequest.Headers.Add("RequestVerificationToken", formToken); 417postRequest.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 418postRequest.Headers.Add("RequestVerificationToken", formToken); 509request.Headers.Add("Cookie", GetCookie(response)); 534request.Headers.Add("Cookie", GetCookie(response)); 559request.Headers.Add("Cookie", GetCookie(response)); 581request.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 582request.Headers.Add("RequestVerificationToken", formToken); 595request.Headers.Add("Cookie", GetCookie(response)); 1507request.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 1508request.Headers.Add("RequestVerificationToken", formToken);
RazorPagesWithBasePathTest.cs (7)
442message.Headers.TryAddWithoutValidation("Cookie", $"{cookie.Key}={cookie.Value}"); 471message.Headers.TryAddWithoutValidation("Cookie", $"{cookie.Key}={cookie.Value}"); 499message.Headers.TryAddWithoutValidation("Cookie", $"{cookie.Key}={cookie.Value}"); 711request.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 712request.Headers.Add("RequestVerificationToken", antiforgeryToken); 762request.Headers.Add("Cookie", cookie.Key + "=" + cookie.Value); 763request.Headers.Add("RequestVerificationToken", formToken);
RequestServicesTestBase.cs (4)
54request.Headers.TryAddWithoutValidation(HeaderNames.RequestId, requestId); 77request.Headers.TryAddWithoutValidation(HeaderNames.RequestId, requestId); 97request1.Headers.TryAddWithoutValidation(HeaderNames.RequestId, requestId1); 106request2.Headers.TryAddWithoutValidation(HeaderNames.RequestId, requestId2);
RespectBrowserAcceptHeaderTests.cs (2)
44request.Headers.Accept.ParseAdd("text/html, application/json, image/jpeg, */*; q=.2"); 63request.Headers.Accept.ParseAdd("text/plain; charset=utf-8");
SerializableErrorTests.cs (4)
51request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptHeader)); 76request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptHeader)); 121request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse(acceptHeader)); 162request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse(acceptHeader));
TempDataInCookiesUsingCookieConsentTest.cs (1)
116request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
TempDataPropertyTest.cs (1)
169request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
TempDataTestBase.cs (1)
272request.Headers.Add("Cookie", new CookieHeaderValue(cookie.Name, cookie.Value).ToString());
TestingInfrastructureTests.cs (5)
60request.Headers.Add("X-Pass-Thru", "Some-Value"); 81request.Headers.Add("X-Pass-Thru", "Some-Value"); 82Assert.True(request.Headers.TryAddWithoutValidation("X-Invalid-Request-Header", "Bearer 1234,5678")); 237request.Headers.Add("Authorization", "Bearer key"); 276request.Headers.Add("X-Added-Header", "true");
ViewEngineTests.cs (2)
164request.Headers.Add("Cookie", 308request.Headers.Add("Cookie",
XmlDataContractSerializerFormattersWrappingTest.cs (8)
45request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 69request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 93request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 116request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 139request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 164request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 187request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs")); 208request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-dcs"));
XmlDataContractSerializerInputFormatterTest.cs (2)
60request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml-dcs")); 88request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml-dcs"));
XmlOutputFormatterTests.cs (10)
43request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 65request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 88request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 109request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 132request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 153request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 171request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 191request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 211request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml")); 232request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml"));
XmlSerializerFormattersWrappingTest.cs (8)
44request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 65request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 86request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 106request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 126request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 148request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 168request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser")); 186request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml-xmlser"));
Microsoft.AspNetCore.Mvc.Testing (3)
Handlers\CookieContainerHandler.cs (1)
47request.Headers.Add(HeaderNames.Cookie, cookieHeader);
Handlers\RedirectHandler.cs (2)
50CopyRequestHeaders(request.Headers, redirectRequest.Headers);
Microsoft.AspNetCore.ResponseCompression.Tests (17)
ResponseCompressionMiddlewareTest.cs (17)
178request.Headers.AcceptEncoding.ParseAdd("gzip"); 336request.Headers.AcceptEncoding.ParseAdd("gzip"); 475request.Headers.AcceptEncoding.ParseAdd("gzip"); 538request.Headers.AcceptEncoding.ParseAdd("gzip"); 601request.Headers.AcceptEncoding.ParseAdd("gzip"); 654request.Headers.AcceptEncoding.ParseAdd(encoding); 699request.Headers.AcceptEncoding.ParseAdd(encoding); 751request.Headers.AcceptEncoding.ParseAdd(encoding); 804request.Headers.AcceptEncoding.ParseAdd(encoding); 874request.Headers.AcceptEncoding.ParseAdd(encoding); 938request.Headers.AcceptEncoding.ParseAdd(encoding); 1002request.Headers.AcceptEncoding.ParseAdd(encoding); 1063request.Headers.AcceptEncoding.ParseAdd("gzip"); 1113request.Headers.AcceptEncoding.ParseAdd("gzip"); 1163request.Headers.AcceptEncoding.ParseAdd("gzip"); 1213request.Headers.AcceptEncoding.ParseAdd(encoding); 1281request.Headers.AcceptEncoding.Add(System.Net.Http.Headers.StringWithQualityHeaderValue.Parse(requestAcceptEncodings[i]));
Microsoft.AspNetCore.Routing.FunctionalTests (7)
MinimalFormTests.cs (7)
54request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 114request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 475request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 534request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 586request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 638request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken); 687request.Headers.Add("Cookie", antiforgeryOptions.Value.Cookie.Name + "=" + tokens.CookieToken);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
Listener\ResponseHeaderTests.cs (1)
349request.Headers.Add("Connection", "Keep-Alive");
OpaqueUpgradeTests.cs (1)
298request.Headers.Connection.Add("upgrade");
Microsoft.AspNetCore.Server.IISIntegration.Tests (13)
IISMiddlewareTests.cs (13)
55req.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 135request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 136request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-EVENT", shutdownEvent); 194request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 195request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-EVENT", "shutdown"); 239request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 240request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-EVENT", "shutdown"); 284request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 285request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-EVENT", shutdownEvent); 384request.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 425req.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 482req.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken"); 527req.Headers.TryAddWithoutValidation("MS-ASPNETCORE-TOKEN", "TestToken");
Microsoft.AspNetCore.SignalR.Client.Tests (18)
HttpConnectionTests.cs (1)
174var headerFound = request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("*/*")) == true;
HttpConnectionTests.Negotiate.cs (3)
344if (request.Headers.Authorization?.Parameter != "firstSecret") 358if (request.Headers.Authorization?.Parameter != "secondSecret") 381if (request.Headers.Authorization?.Parameter != "secondSecret")
HttpConnectionTests.Transport.cs (8)
44Assert.Equal("Bearer", request.Headers.Authorization.Scheme); 47Assert.Equal(callCount.ToString(CultureInfo.InvariantCulture), request.Headers.Authorization.Parameter); 119var userAgentHeader = request.Headers.UserAgent.ToString(); 167var requestedWithHeader = request.Headers.GetValues(HeaderNames.XRequestedWith); 389Assert.Equal("Bearer", request.Headers.Authorization.Scheme); 391Assert.Equal(accessTokenCallCount.ToString(CultureInfo.InvariantCulture), request.Headers.Authorization.Parameter); 489Assert.Equal("Bearer", request.Headers.Authorization.Scheme); 491Assert.Equal(accessTokenCallCount.ToString(CultureInfo.InvariantCulture), request.Headers.Authorization.Parameter);
LongPollingTransportTests.cs (1)
709if (request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("*/*")) != true)
ResponseUtils.cs (1)
55return request.Method == HttpMethod.Get && request.Headers.Accept.Any(h => h.MediaType == "text/event-stream");
SendUtilsTests.cs (1)
24if (request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("*/*")) == true)
ServerSentEventsTransportTests.cs (3)
180if (request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("text/event-stream")) == true) 309if (request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("text/event-stream")) == true) 417if (request.Headers.Accept?.Contains(new MediaTypeWithQualityHeaderValue("text/event-stream")) == true)
Microsoft.AspNetCore.SpaServices.Extensions (2)
Proxying\SpaProxy.cs (2)
152if (!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()) && requestMessage.Content != null) 158requestMessage.Headers.Host = uri.Authority;
Microsoft.AspNetCore.StaticAssets.Tests (28)
StaticAssetsIntegrationTests.cs (28)
439message.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); 652req.Headers.Add("If-Match", "\"fake\""); 665req.Headers.Add("If-Match", original.Headers.ETag.ToString()); 676req.Headers.Add("If-Match", "*"); 687req.Headers.Add("If-Match", "*"); 714req2.Headers.Add("If-None-Match", resp1.Headers.ETag.ToString()); 727req2.Headers.Add("If-None-Match", "*"); 740req2.Headers.Add("If-None-Match", resp1.Headers.ETag.ToString()); 787req2.Headers.Add("If-None-Match", resp1.Headers.ETag.ToString()); 788req2.Headers.IfModifiedSince = resp1.Content.Headers.LastModified; 804req2.Headers.Add("If-Match", etag + ", " + etag); 811req3.Headers.Add("If-Match", etag + ", \"badetag\""); 830req2.Headers.IfNoneMatch.Add(new EntityTagHeaderValue("\"fake\"")); 831req2.Headers.IfModifiedSince = lastModified; 835req3.Headers.IfNoneMatch.Add(resp1.Headers.ETag); 836req3.Headers.IfModifiedSince = pastDate; 840req4.Headers.IfNoneMatch.Add(new EntityTagHeaderValue("\"fake\"")); 841req4.Headers.IfModifiedSince = futureDate; 868req.Headers.TryAddWithoutValidation("If-Modified-Since", "bad-date"); 881req.Headers.IfModifiedSince = DateTimeOffset.Now.AddYears(1); 904req2.Headers.IfModifiedSince = DateTimeOffset.Now; 928req2.Headers.TryAddWithoutValidation("If-Modified-Since", DateTimeOffset.UtcNow.ToString(format, CultureInfo.InvariantCulture)); 945req2.Headers.IfModifiedSince = DateTimeOffset.MinValue; 958req.Headers.TryAddWithoutValidation("If-Unmodified-Since", "bad-date"); 970req.Headers.IfUnmodifiedSince = DateTimeOffset.Now.AddYears(1); 986req2.Headers.IfUnmodifiedSince = DateTimeOffset.MinValue; 1003req1.Headers.Range = new RangeHeaderValue(0, 4); 1007req2.Headers.Range = new RangeHeaderValue(7, 11);
Microsoft.AspNetCore.StaticFiles.Tests (50)
CacheHeaderTests.cs (16)
51req.Headers.Add("If-Match", "\"fake\""); 65req.Headers.Add("If-Match", original.Headers.ETag.ToString()); 77req.Headers.Add("If-Match", "*"); 89req.Headers.Add("If-Match", "*"); 117req2.Headers.Add("If-None-Match", resp1.Headers.ETag.ToString()); 131req2.Headers.Add("If-None-Match", "*"); 145req2.Headers.Add("If-None-Match", resp1.Headers.ETag.ToString()); 197.And(req => req.Headers.IfModifiedSince = resp1.Content.Headers.LastModified) 246.And(req => req.Headers.IfModifiedSince = lastModified) 252.And(req => req.Headers.IfModifiedSince = pastDate) 258.And(req => req.Headers.IfModifiedSince = futureDate) 302.And(req => req.Headers.IfModifiedSince = DateTimeOffset.Now.AddYears(1)) 328.And(req => req.Headers.IfModifiedSince = DateTimeOffset.Now) 375.And(req => req.Headers.IfModifiedSince = DateTimeOffset.MinValue) 405.And(req => req.Headers.IfUnmodifiedSince = DateTimeOffset.Now.AddYears(1)) 424.And(req => req.Headers.IfUnmodifiedSince = DateTimeOffset.MinValue)
RangeHeaderTests.cs (34)
24req.Headers.Add("If-Range", original.Headers.ETag.ToString()); 25req.Headers.Add("Range", "bytes=0-10"); 45req.Headers.Add("If-Range", original.Headers.ETag.ToString()); 46req.Headers.Add("Range", "bytes=0-10"); 66req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.ToString("r")); 67req.Headers.Add("Range", "bytes=0-10"); 83req.Headers.Add("If-Modified-Since", original.Content.Headers.LastModified.Value.AddHours(-1).ToString("r")); 84req.Headers.Add("Range", "bytes=0-10"); 100req.Headers.Add("If-Modified-Since", original.Content.Headers.LastModified.Value.ToString("r")); 101req.Headers.Add("Range", "bytes=0-10"); 117req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.ToString("r")); 118req.Headers.Add("Range", "bytes=0-10"); 136req.Headers.Add("If-Range", "\"OldEtag\""); 137req.Headers.Add("Range", "bytes=0-10"); 153req.Headers.Add("If-Range", "\"OldEtag\""); 154req.Headers.Add("Range", "bytes=0-10"); 172req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.Subtract(TimeSpan.FromDays(1)).ToString("r")); 173req.Headers.Add("Range", "bytes=0-10"); 191req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.Subtract(TimeSpan.FromDays(1)).ToString("r")); 192req.Headers.Add("Range", "bytes=0-10"); 211req.Headers.Add("If-Range", original.Headers.ETag.ToString()); 219req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.ToString("r")); 238req.Headers.Add("If-Range", original.Headers.ETag.ToString()); 246req.Headers.Add("If-Range", original.Content.Headers.LastModified.Value.ToString("r")); 271req.Headers.Add("Range", "bytes=" + range); 292req.Headers.Add("Range", "bytes=" + range); 313req.Headers.Add("Range", "bytes=" + range); 327req.Headers.Add("Range", "bytes=" + range); 345req.Headers.TryAddWithoutValidation("Range", "bytes=" + range); 360req.Headers.TryAddWithoutValidation("Range", "bytes=" + range); 380req.Headers.TryAddWithoutValidation("Range", "bytes=" + range); 402req.Headers.TryAddWithoutValidation("Range", "bytes=" + range); 423req.Headers.Add("Range", "bytes=" + ranges); 443req.Headers.Add("Range", "bytes=" + range);
Microsoft.AspNetCore.TestHost (4)
ClientHandler.cs (3)
123if (request.Headers.TransferEncodingChunked != true) 131request.Headers.TransferEncodingChunked = true; 157foreach (var header in request.Headers)
RequestBuilder.cs (1)
52if (!_req.Headers.TryAddWithoutValidation(name, value))
Microsoft.AspNetCore.TestHost.Tests (2)
RequestBuilderTests.cs (1)
19Assert.Equal("MyHost:90", request.Headers.Host.ToString());
TestServerTests.cs (1)
791request.Headers.Host = "otherhost:5678";
Microsoft.AspNetCore.WebSockets.Tests (28)
WebSocketCompressionMiddlewareTests.cs (9)
37request.Headers.Add(HeaderNames.SecWebSocketExtensions, "permessage-deflate"); 65request.Headers.Add(HeaderNames.SecWebSocketExtensions, "permessage-deflate"); 99request.Headers.Add(HeaderNames.SecWebSocketExtensions, clientHeader); 170request.Headers.Connection.Clear(); 171request.Headers.Connection.Add("Upgrade"); 172request.Headers.Connection.Add("keep-alive"); 173request.Headers.Upgrade.Add(new System.Net.Http.Headers.ProductHeaderValue("websocket")); 174request.Headers.Add(HeaderNames.SecWebSocketVersion, "13"); 176request.Headers.Add(HeaderNames.SecWebSocketKey, Convert.ToBase64String(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, Base64FormattingOptions.None));
WebSocketMiddlewareTests.cs (19)
677request.Headers.Connection.Clear(); 678request.Headers.Connection.Add("Upgrade"); 679request.Headers.Upgrade.Add(new System.Net.Http.Headers.ProductHeaderValue("websocket")); 680request.Headers.Add(HeaderNames.SecWebSocketVersion, "13"); 682request.Headers.Add(HeaderNames.SecWebSocketKey, Convert.ToBase64String(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, Base64FormattingOptions.None)); 684request.Headers.Add(HeaderNames.Origin, "http://example.com"); 710request.Headers.Add("Origin", "http://notexample.com"); 760request.Headers.Connection.Clear(); 761request.Headers.Connection.Add("Upgrade"); 762request.Headers.Connection.Add("keep-alive"); 763request.Headers.Upgrade.Add(new System.Net.Http.Headers.ProductHeaderValue("websocket")); 764request.Headers.Upgrade.Add(new System.Net.Http.Headers.ProductHeaderValue("example")); 765request.Headers.Add(HeaderNames.SecWebSocketVersion, "13"); 767request.Headers.Add(HeaderNames.SecWebSocketKey, Convert.ToBase64String(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, Base64FormattingOptions.None)); 833request.Headers.Connection.Clear(); 834request.Headers.Connection.Add("Upgrade"); 835request.Headers.Upgrade.Add(new System.Net.Http.Headers.ProductHeaderValue("websocket")); 836request.Headers.Add(HeaderNames.SecWebSocketVersion, "13"); 838request.Headers.Add(HeaderNames.SecWebSocketKey, Convert.ToBase64String(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, Base64FormattingOptions.None));
Microsoft.DotNet.Internal.SymbolHelper (1)
SymbolUploadHelperFactory.cs (1)
153getToolRequest.Headers.Add("X-TFS-FedAuthRedirect", "Suppress");
Microsoft.Extensions.Http (2)
Logging\LogHelper.cs (2)
108new HttpHeadersLogValue(HttpHeadersLogValue.Kind.Request, request.Headers, request.Content?.Headers, shouldRedactHeaderValue), 147new HttpHeadersLogValue(HttpHeadersLogValue.Kind.Request, request.Headers, request.Content?.Headers, shouldRedactHeaderValue),
Microsoft.Extensions.Http.Diagnostics (2)
Latency\Internal\HttpLatencyTelemetryHandler.cs (1)
49request.Headers.Add(TelemetryConstants.ClientApplicationNameHeader, _applicationName);
Logging\Internal\HttpHeadersReader.cs (1)
48ReadHeaders(request.Headers, _requestHeadersToLog, destination);
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (1)
Benchmarks\HeadersReaderBenchmark.cs (1)
38Request.Headers.Add($"Header{i}", $"Value{i}");
Microsoft.Extensions.Http.Diagnostics.Tests (31)
Latency\Internal\HttpLatencyTelemetryHandlerTest.cs (1)
71Assert.True(req.Headers.Contains(TelemetryConstants.ClientApplicationNameHeader));
Logging\AcceptanceTests.cs (10)
168httpRequestMessage.Headers.Add("requestHeader", "Request Value"); 169httpRequestMessage.Headers.Add("ReQuEStHeAdErFirst", new List<string> { "Request Value 2", "Request Value 3" }); 184httpRequestMessage2.Headers.Add("requestHeader", "Request Value"); 185httpRequestMessage2.Headers.Add("ReQuEStHeAdErSecond", new List<string> { "Request Value 2", "Request Value 3" }); 249httpRequestMessage.Headers.Add("requestHeader", "Request Value"); 250httpRequestMessage.Headers.Add("ReQuEStHeAdEr2", new List<string> { "Request Value 2", "Request Value 3" }); 271httpRequestMessage2.Headers.Add("requestHeader", "Request Value"); 272httpRequestMessage2.Headers.Add("ReQuEStHeAdEr2", new List<string> { "Request Value 2", "Request Value 3" }); 685httpRequestMessage.Headers.Add("requestHeader", "Request Value"); 686httpRequestMessage.Headers.Add("ReQuEStHeAdEr2", new List<string> { "Request Value 2", "Request Value 3" });
Logging\HttpClientLoggerTest.cs (7)
190httpRequestMessage.Headers.Add(TestRequestHeader, testRequestHeaderValue); 191httpRequestMessage.Headers.Add("Header3", testRequestHeaderValue); 285httpRequestMessage.Headers.Add(TestRequestHeader, requestHeaderValue); 391httpRequestMessage.Headers.Add(TestRequestHeader, requestHeaderValue); 487httpRequestMessage.Headers.Add(TestRequestHeader, requestHeaderValue); 601httpRequestMessage.Headers.Add(TestRequestHeader, requestHeaderValue); 868httpRequestMessage.Headers.Add(TestRequestHeader, requestHeaderValue);
Logging\HttpHeadersReaderTest.cs (5)
74httpRequest.Headers.Add("Header1", "Value.1"); 75httpRequest.Headers.Add("Header2", "Value.2"); 78httpRequest.Headers.Add("Header5", string.Empty); 137httpRequest.Headers.Add("Header1", "Value.1"); 138httpRequest.Headers.Add("Header2", "Value.2");
Logging\HttpRequestReaderTest.cs (8)
87httpRequestMessage.Headers.Add(header1.Key, header1.Value); 88httpRequestMessage.Headers.Add(header3.Key, header3.Value); 213httpRequestMessage.Headers.Add(header1.Key, header1.Value); 288httpRequestMessage.Headers.Add(header1.Key, header1.Value); 360httpRequestMessage.Headers.Add(header1.Key, header1.Value); 418httpRequestMessage.Headers.Add(header1.Key, header1.Value); 489httpRequestMessage.Headers.Add(header1.Key, header1.Value); 556httpRequestMessage.Headers.Add(header1.Key, header1.Value);
Microsoft.Extensions.Http.Resilience (2)
Internal\RequestMessageSnapshot.cs (2)
53_ = clone.Headers.TryAddWithoutValidation(header.Key, header.Value); 87_headers.AddRange(request.Headers);
Microsoft.Extensions.Http.Resilience.Tests (2)
Resilience\RequestMessageSnapshotTests.cs (2)
63initialRequest.Headers.Add("Authorization", "Bearer token"); 84Assert.NotNull(cloned.Headers.Authorization);
Microsoft.Extensions.Logging.AzureAppServices (3)
BlobAppendReferenceWrapper.cs (3)
77message.Headers.Add("x-ms-blob-type", "AppendBlob"); 78message.Headers.Add("x-ms-version", "2016-05-31"); 79message.Headers.Date = DateTimeOffset.UtcNow;
Microsoft.Extensions.ServiceDiscovery (2)
Http\ResolvingHttpClientHandler.cs (1)
27request.Headers.Host ??= result.Features.Get<IHostNameFeature>()?.HostName;
Http\ResolvingHttpDelegatingHandler.cs (1)
48request.Headers.Host ??= result.Features.Get<IHostNameFeature>()?.HostName;
ServerComparison.FunctionalTests (2)
ResponseCompressionTests.cs (2)
168request.Headers.AcceptEncoding.ParseAdd("gzip,deflate"); 200request.Headers.AcceptEncoding.ParseAdd("gzip,deflate");
SocialSample (4)
Startup.cs (4)
138request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); 139request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 199request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); 200request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
System.Net.Http (43)
System\Net\Http\DiagnosticsHandler.cs (3)
104request.Headers.Remove(field); 353!request.Headers.TryGetHeaderValue(descriptor, out _)) 355request.Headers.TryAddWithoutValidation(descriptor, value);
System\Net\Http\HttpClient.cs (1)
777request.Headers.AddHeaders(_defaultRequestHeaders);
System\Net\Http\SocketsHttpHandler\AuthenticationHelper.cs (2)
168request.Headers.ProxyAuthorization = headerValue; 172request.Headers.Authorization = headerValue;
System\Net\Http\SocketsHttpHandler\AuthenticationHelper.NtAuth.cs (2)
122if (!isProxyAuth && request.HasHeaders && request.Headers.Host != null) 125hostName = request.Headers.Host;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (3)
360request.Headers.NonValidated.TryGetValues(HttpKnownHeaderNames.UserAgent, out HeaderStringValues userAgent)) 785tunnelRequest.Headers.Host = $"{_originAuthority.IdnHost}:{_originAuthority.Port}"; // This specifies destination host/port to connect to 789tunnelRequest.Headers.TryAddWithoutValidation(KnownHeaders.UserAgent.Descriptor, _connectTunnelUserAgent);
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (6)
54if (GZipEnabled && !EncodingExists(request.Headers.AcceptEncoding, Gzip)) 56request.Headers.AcceptEncoding.Add(s_gzipHeaderValue); 59if (DeflateEnabled && !EncodingExists(request.Headers.AcceptEncoding, Deflate)) 61request.Headers.AcceptEncoding.Add(s_deflateHeaderValue); 64if (BrotliEnabled && !EncodingExists(request.Headers.AcceptEncoding, Brotli)) 66request.Headers.AcceptEncoding.Add(s_brotliHeaderValue);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (6)
1491if (request.HasHeaders && request.Headers.Host is string host) 1516if (request.Headers.TransferEncodingChunked == true) 1518request.Headers.TransferEncodingChunked = false; 1521if (request.Headers.Protocol is string protocol) 1529headerListSize += WriteHeaderCollection(request, request.Headers, ref headerBuffer); 1993bool shouldExpectContinue = (request.Content != null && request.HasHeaders && request.Headers.ExpectContinue == true);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
129if (_request.HasHeaders && _request.Headers.ExpectContinue == true)
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (5)
159if (_request.HasHeaders && _request.Headers.ExpectContinue == true) 626if (request.HasHeaders && request.Headers.Host is string host) 654if (request.HasHeaders && request.Headers.TransferEncodingChunked == true) 656request.Headers.TransferEncodingChunked = false; 659headerListSize += BufferHeaderCollection(request.Headers);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (5)
320if (!request.HasHeaders || request.Headers.Host is not string host) 347if (!request.HasHeaders || request.Headers.Host is null) 377WriteHeaderCollection(request.Headers, cookiesFromContainer); 567bool hasExpectContinueHeader = request.HasHeaders && request.Headers.ExpectContinue == true; 945bool requestTransferEncodingChunked = request.HasHeaders && request.Headers.TransferEncodingChunked == true;
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (1)
270string? hostHeader = request.Headers.Host;
System\Net\Http\SocketsHttpHandler\RedirectHandler.cs (3)
54request.Headers.Authorization = null; 76if (request.Headers.TransferEncodingChunked == true) 78request.Headers.TransferEncodingChunked = false;
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (5)
639if (request.HasHeaders && request.Headers.TransferEncodingChunked.GetValueOrDefault()) 654request.Headers.TransferEncodingChunked = true; 660if (request.Headers.TransferEncodingChunked == true) 666if (request.Headers.ExpectContinue == true) 668request.Headers.ExpectContinue = false;
System.Net.Requests (8)
System\Net\HttpWebRequest.cs (8)
1186_sendRequestMessage.Headers.Host = Host; 1205_sendRequestMessage.Headers.TryAddWithoutValidation(headerName, _webHeaderCollection[headerName!]); 1211_sendRequestMessage.Headers.ExpectContinue = true; 1214_sendRequestMessage.Headers.TransferEncodingChunked = SendChunked; 1218_sendRequestMessage.Headers.Connection.Add(HttpKnownHeaderNames.KeepAlive); 1222_sendRequestMessage.Headers.ConnectionClose = true; 1292HttpHeaderValueCollection<NameValueHeaderValue> pragmaHeaders = request.Headers.Pragma; 1376request.Headers.CacheControl = cacheControl;
System.Net.WebSockets.Client (8)
System\Net\WebSockets\WebSocketHandle.Managed.cs (8)
104request.Headers.TryAddWithoutValidation(key, options.RequestHeaders[key]); 391request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.Connection, HttpKnownHeaderNames.Upgrade); 392request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.Upgrade, "websocket"); 393request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.SecWebSocketKey, secKeyAndSecWebSocketAccept.Key); 397request.Headers.Protocol = "websocket"; 400request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.SecWebSocketVersion, "13"); 404request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.SecWebSocketProtocol, string.Join(", ", options.RequestedSubProtocols)); 408request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.SecWebSocketExtensions, GetDeflateOptions(options.DangerousDeflateOptions));
Templates.Blazor.Tests (5)
BlazorWebTemplateTest.cs (4)
87request.Headers.AcceptEncoding.Clear(); 88request.Headers.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("gzip")); 89request.Headers.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("deflate")); 90request.Headers.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("br"));
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
270request.Headers.Add("Accept", acceptContentType);
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
270request.Headers.Add("Accept", acceptContentType);
Templates.Blazor.WebAssembly.Tests (1)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
270request.Headers.Add("Accept", acceptContentType);
Templates.Mvc.Tests (1)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
270request.Headers.Add("Accept", acceptContentType);
Templates.Tests (1)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
270request.Headers.Add("Accept", acceptContentType);