1 override of ContentType
Microsoft.AspNetCore.Http (1)
Internal\DefaultHttpRequest.cs (1)
144public override string? ContentType
214 writes to ContentType
Microsoft.AspNetCore.Antiforgery.Test (9)
DefaultAntiforgeryTest.cs (2)
898context.HttpContext.Request.ContentType = "application/json"; 924context.HttpContext.Request.ContentType = "application/x-www-form-urlencoded";
DefaultAntiforgeryTokenStoreTest.cs (7)
101httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 130httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 159httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 189httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 217httpContext.Request.ContentType = "application/json"; 245httpContext.Request.ContentType = "application/json"; 272httpContext.Request.ContentType = "application/x-www-form-urlencoded";
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
RazorComponentEndpointInvokerTest.cs (1)
44context.Request.ContentType = "application/json";
Microsoft.AspNetCore.Components.Server.Tests (6)
CircuitDisconnectMiddlewareTest.cs (6)
64context.Request.ContentType = contentType; 91context.Request.ContentType = "application/x-www-form-urlencoded"; 122context.Request.ContentType = "application/x-www-form-urlencoded"; 155context.Request.ContentType = "application/x-www-form-urlencoded"; 192context.Request.ContentType = "application/x-www-form-urlencoded"; 230context.Request.ContentType = "application/x-www-form-urlencoded";
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (15)
UnaryServerCallHandlerTests.cs (15)
210httpContext.Request.ContentType = "application/json"; 249httpContext.Request.ContentType = "application/json"; 296httpContext.Request.ContentType = "application/json"; 346httpContext.Request.ContentType = "application/json"; 396httpContext.Request.ContentType = "application/json"; 446httpContext.Request.ContentType = "application/json"; 496httpContext.Request.ContentType = "application/json"; 740httpContext.Request.ContentType = "application/json"; 778httpContext.Request.ContentType = "application/json"; 807httpContext.Request.ContentType = contentType; 1140httpContext.Request.ContentType = "application/xml"; 1184httpContext.Request.ContentType = "application/octet-stream"; 1227httpContext.Request.ContentType = "application/json"; 1262httpContext.Request.ContentType = "application/json"; 1724httpContext.Request.ContentType = "application/json";
Microsoft.AspNetCore.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (5)
245c.Request.ContentType = "text/plain"; 304c.Request.ContentType = "text/plain"; 364c.Request.ContentType = "text/plain"; 419c.Request.ContentType = "text/plain"; 1054c.Request.ContentType = "text/plain";
Microsoft.AspNetCore.Http.Extensions.Tests (15)
HttpRequestJsonExtensionsTests.cs (15)
29request.ContentType = contentType; 39context.Request.ContentType = "text/json"; 54context.Request.ContentType = "application/json"; 69context.Request.ContentType = "application/json"; 84context.Request.ContentType = "application/json"; 105context.Request.ContentType = "application/json; charset=utf-8"; 123context.Request.ContentType = "application/json; charset=utf-16"; 138context.Request.ContentType = "application /json"; 158context.Request.ContentType = "application/json; charset=invalid"; 172context.Request.ContentType = "application/json"; 187context.Request.ContentType = "application/json; charset=utf-16"; 202context.Request.ContentType = "application/json; charset=invalid"; 216context.Request.ContentType = "application/json"; 237context.Request.ContentType = "application/json"; 259context.Request.ContentType = "application/json";
Microsoft.AspNetCore.Http.Tests (19)
DefaultHttpContextTests.cs (1)
318context.Request.ContentType = "application/json";
Features\FormFeatureTests.cs (16)
17context.Request.ContentType = MultipartContentType; 32context.Request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; 55context.Request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; 90context.Request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; 205context.Request.ContentType = MultipartContentType; 240context.Request.ContentType = MultipartContentType; 277context.Request.ContentType = MultipartContentType; 325context.Request.ContentType = MultipartContentTypeWithSpecialCharacters; 362context.Request.ContentType = MultipartContentType; 410context.Request.ContentType = MultipartContentType; 462context.Request.ContentType = MultipartContentType; 486context.Request.ContentType = MultipartContentType; 510context.Request.ContentType = MultipartContentType; 534context.Request.ContentType = MultipartContentType; 559context.Request.ContentType = MultipartContentType; 602context.Request.ContentType = MultipartContentType;
Internal\DefaultHttpRequestTests.cs (2)
283context.Request.ContentType = "application/json"; 330context.Request.ContentType = "application/json";
Microsoft.AspNetCore.HttpLogging.Tests (15)
HttpLoggingMiddlewareTests.cs (15)
298httpContext.Request.ContentType = "text/plain"; 329httpContext.Request.ContentType = "text/plain"; 357httpContext.Request.ContentType = "text/plain"; 385httpContext.Request.ContentType = "text/plain"; 421httpContext.Request.ContentType = "text/plain"; 457httpContext.Request.ContentType = "text/plain"; 482httpContext.Request.ContentType = "text/plain"; 508httpContext.Request.ContentType = "text/plain"; 547httpContext.Request.ContentType = contentType; 587httpContext.Request.ContentType = contentType; 626httpContext.Request.ContentType = "text/plain"; 664httpContext.Request.ContentType = "text/plain; charset=" + Encoding.ASCII.WebName; 703httpContext.Request.ContentType = "text/plain; charset=" + Encoding.UTF32.WebName; 1523httpContext.Request.ContentType = null; 1963httpContext.Request.ContentType = "text/plain";
Microsoft.AspNetCore.Mvc.Core.Test (38)
ConsumesAttributeTests.cs (4)
301httpContext.Request.ContentType = contentType; 331httpContext.Request.ContentType = contentType; 360httpContext.Request.ContentType = contentType; 423httpContext.Request.ContentType = contentType;
Formatters\InputFormatterTest.cs (9)
35httpContext.Request.ContentType = requestContentType; 69httpContext.Request.ContentType = requestContentType; 100httpContext.Request.ContentType = requestContentType; 134httpContext.Request.ContentType = requestContentType; 165httpContext.Request.ContentType = requestContentType; 202httpContext.Request.ContentType = requestContentType; 232httpContext.Request.ContentType = requestContentType; 270httpContext.Request.ContentType = requestContentType; 299httpContext.Request.ContentType = requestContentType;
Formatters\JsonInputFormatterTestBase.cs (1)
642httpContext.Request.ContentType = contentType;
Formatters\JsonOutputFormatterTestBase.cs (1)
167httpContext.Request.ContentType = contentType.ToString();
Formatters\TextInputFormatterTest.cs (6)
26context.HttpContext.Request.ContentType = "application/json;charset=utf-8"; 76context.HttpContext.Request.ContentType = "application/json;charset=" + charset; 100context.HttpContext.Request.ContentType = "application/json;charset=utf-8"; 126context.HttpContext.Request.ContentType = "application/json;charset=" + charset; 160context.HttpContext.Request.ContentType = "application/json;charset=\"" + charset + "\""; 194context.HttpContext.Request.ContentType = contentType;
ModelBinding\Binders\BodyModelBinderTests.cs (11)
254httpContext.Request.ContentType = "text/xyz"; 302httpContext.Request.ContentType = "application/xml"; 331httpContext.Request.ContentType = "application/json"; 373httpContext.Request.ContentType = "application/xml"; 402httpContext.Request.ContentType = "application/json"; 449httpContext.Request.ContentType = contentType; 484httpContext.Request.ContentType = contentType; 513httpContext.Request.ContentType = "text/xyz"; 536httpContext.Request.ContentType = "text/xyz"; 604bindingContext.HttpContext.Request.ContentType = "application/json"; 633bindingContext.HttpContext.Request.ContentType = "multipart/form-data";
ModelBinding\FormFileValueProviderFactoryTest.cs (1)
116context.Request.ContentType = contentType;
ModelBinding\FormFileValueProviderTest.cs (3)
16httpContext.Request.ContentType = "multipart/form-data"; 35httpContext.Request.ContentType = "multipart/form-data"; 54httpContext.Request.ContentType = "multipart/form-data";
ModelBinding\FormValueProviderFactoryTest.cs (1)
104context.Request.ContentType = contentType;
ModelBinding\JQueryFormValueProviderFactoryTest.cs (1)
189context.Request.ContentType = contentType;
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (12)
XmlDataContractSerializerInputFormatterTest.cs (5)
150httpContext.Request.ContentType = "application/json"; 214httpContext.Request.ContentType = "application/xml"; 249httpContext.Request.ContentType = "application/json"; 281httpContext.Request.ContentType = "application/xml"; 340httpContext.Request.ContentType = "application/xml";
XmlDataContractSerializerOutputFormatterTest.cs (1)
805request.ContentType = contentType;
XmlSerializerInputFormatterTest.cs (5)
55httpContext.Request.ContentType = "application/json"; 92httpContext.Request.ContentType = "application/xml"; 128httpContext.Request.ContentType = "application/json"; 164httpContext.Request.ContentType = "application/xml"; 206httpContext.Request.ContentType = "application/xml";
XmlSerializerOutputFormatterTest.cs (1)
587request.ContentType = contentType;
Microsoft.AspNetCore.Mvc.IntegrationTests (55)
BindingSourceMetadataProviderIntegrationTest.cs (1)
128request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
BodyValidationIntegrationTests.cs (19)
37request.ContentType = "application/json;charset=utf-8"; 78request.ContentType = "application/json;charset=utf-8"; 112request.ContentType = "application/json"; 162request.ContentType = "application/json"; 203request.ContentType = "application/json"; 243request.ContentType = "application/json"; 279request.ContentType = "application/json"; 324request.ContentType = "application/json"; 372request.ContentType = "application/json"; 414request.ContentType = "application/json"; 448request.ContentType = "application/json"; 528request.ContentType = "application/json"; 555request.ContentType = "application/json"; 621request.ContentType = "application/json"; 666request.ContentType = "application/json"; 718request.ContentType = "application/json"; 777request.ContentType = "application/json"; 822request.ContentType = "application/json"; 868request.ContentType = "application/json";
CollectionModelBinderIntegrationTest.cs (2)
605request.ContentType = "application/x-www-form-urlencoded"; 662request.ContentType = "application/x-www-form-urlencoded";
ComplexRecordIntegrationTest.cs (4)
145request.ContentType = "application/json"; 199request.ContentType = "application/json"; 4207request.ContentType = "application/json"; 4225request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
ComplexTypeIntegrationTestBase.cs (3)
182request.ContentType = "application/json"; 3706request.ContentType = "application/json"; 3724request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
DictionaryModelBinderIntegrationTest.cs (7)
289request.ContentType = "application/x-www-form-urlencoded"; 294request.ContentType = "application/x-www-form-urlencoded"; 299request.ContentType = "application/x-www-form-urlencoded"; 304request.ContentType = "application/x-www-form-urlencoded"; 309request.ContentType = "application/x-www-form-urlencoded"; 314request.ContentType = "application/x-www-form-urlencoded"; 319request.ContentType = "application/x-www-form-urlencoded";
FormCollectionModelBindingIntegrationTest.cs (1)
164request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
FormFileModelBindingIntegrationTest.cs (1)
1255request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
JQueryFormatModelBindingIntegrationTest.cs (1)
70request.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
SimpleTypeModelBinderIntegrationTest.cs (1)
295request.ContentType = "application/json";
TryUpdateModelIntegrationTest.cs (1)
1280request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq";
ValidationIntegrationTests.cs (7)
99request.ContentType = "application/json"; 141request.ContentType = "application/json"; 1738request.ContentType = "application/json"; 1792request.ContentType = "application/json"; 1882request.ContentType = "application/json"; 1929request.ContentType = "application/json"; 1987request.ContentType = "application/json";
ValidationWithRecordIntegrationTests.cs (7)
91request.ContentType = "application/json"; 133request.ContentType = "application/json"; 1541request.ContentType = "application/json"; 1595request.ContentType = "application/json"; 1685request.ContentType = "application/json"; 1732request.ContentType = "application/json"; 1782request.ContentType = "application/json";
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (9)
NewtonsoftJsonInputFormatterTest.cs (5)
42httpContext.Request.ContentType = "application/json"; 78httpContext.Request.ContentType = "application/json"; 114httpContext.Request.ContentType = "application/json"; 506httpContext.Request.ContentType = "application/json"; 549httpContext.Request.ContentType = "application/json";
NewtonsoftJsonPatchInputFormatterTest.cs (2)
41httpContext.Request.ContentType = "application/json"; 78httpContext.Request.ContentType = "application/json";
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
642httpContext.Request.ContentType = contentType;
src\Mvc\Mvc.Core\test\Formatters\JsonOutputFormatterTestBase.cs (1)
167httpContext.Request.ContentType = contentType.ToString();
Microsoft.AspNetCore.Rewrite.Tests (1)
IISUrlRewrite\ServerVariableTests.cs (1)
144context.Request.ContentType = "json";
Microsoft.AspNetCore.Routing.Tests (14)
EndpointRoutingMiddlewareFormOptionsTest.cs (5)
31httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 63httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 103httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 135httpContext.Request.ContentType = "application/x-www-form-urlencoded"; 196ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq",
Matching\AcceptsMatcherPolicyTest.cs (9)
304httpContext.Request.ContentType = contentType; 390ContentType = "text/plain", 417ContentType = "text/plain", 444ContentType = "text/plain", 471ContentType = "application/project+json", 498ContentType = "application/xml", 525ContentType = "application/json", 554ContentType = "application/json", 583ContentType = "application/json",
54 references to ContentType
Aspire.Dashboard (2)
Otlp\Http\OtlpHttpEndpointsBuilder.cs (2)
113switch (GetKnownContentType(context.Request.ContentType, out var charSet)) 148switch (GetKnownContentType(httpContext.Request.ContentType, out _))
InMemory.FunctionalTests (2)
Http3\Http3ConnectionTests.cs (1)
426contentType = context.Request.ContentType;
RequestTests.cs (1)
2085contentTypeHeaderValue = context.Request.ContentType;
Interop.FunctionalTests (1)
Http3\Http3RequestTests.cs (1)
328contentType = context.Request.ContentType;
Microsoft.AspNetCore.Authentication.OpenIdConnect (4)
OpenIdConnectHandler.cs (4)
118&& !string.IsNullOrEmpty(Request.ContentType) 120&& Request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase) 661&& !string.IsNullOrEmpty(Request.ContentType) 663&& Request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase)
Microsoft.AspNetCore.Authentication.WsFederation (2)
WsFederationHandler.cs (2)
155&& !string.IsNullOrEmpty(Request.ContentType) 157&& Request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase)
Microsoft.AspNetCore.Components.Endpoints (2)
RazorComponentEndpointInvoker.cs (2)
170if (context.Request.ContentType is not null && MediaTypeHeaderValue.TryParse(context.Request.ContentType, out var type))
Microsoft.AspNetCore.Grpc.JsonTranscoding (4)
Internal\JsonRequestHelpers.cs (4)
32if (!MediaTypeHeaderValue.TryParse(request.ContentType, out var mt)) 205GrpcServerLog.UnsupportedRequestContentType(serverCallContext.Logger, serverCallContext.HttpContext.Request.ContentType); 206throw new InvalidOperationException($"Unable to read the request as JSON because the request content type '{serverCallContext.HttpContext.Request.ContentType}' is not a known JSON content type."); 322var contentType = serverCallContext.HttpContext.Request.ContentType;
Microsoft.AspNetCore.Hosting (3)
Internal\HostingRequestStartingLog.cs (3)
272 => new KeyValuePair<string, object?>(nameof(_request.ContentType), _request.ContentType), 48_cachedToString = $"Request starting {request.Protocol} {request.Method} {request.Scheme}://{request.Host.Value}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value} - {EscapedValueOrEmptyMarker(request.ContentType)} {ValueOrEmptyMarker(request.ContentLength)}";
Microsoft.AspNetCore.Hosting.Tests (1)
Internal\HostingRequestStartLogTests.cs (1)
24mockRequest.Setup(request => request.ContentType).Returns("test");
Microsoft.AspNetCore.Http (7)
Features\FormFeature.cs (2)
79_ = MediaTypeHeaderValue.TryParse(_request.ContentType, out mt); 189throw new InvalidOperationException("Incorrect Content-Type: " + _request.ContentType);
RequestFormReaderExtensions.cs (1)
29throw new InvalidOperationException("Incorrect Content-Type: " + request.ContentType);
src\Shared\Debugger\HttpContextDebugFormatter.cs (4)
45if (!string.IsNullOrEmpty(request.ContentType)) 48sb.Append(request.ContentType); 67if (!string.IsNullOrEmpty(context.Request.ContentType)) 70sb.Append(context.Request.ContentType);
Microsoft.AspNetCore.Http.Extensions (5)
HttpRequestJsonExtensions.cs (2)
279if (!MediaTypeHeaderValue.TryParse(request.ContentType, out var mt)) 312throw new InvalidOperationException($"Unable to read the request as JSON because the request content type '{request.ContentType}' is not a known JSON content type.");
HttpRequestMultipartExtensions.cs (1)
22if (!MediaTypeHeaderValue.TryParse(request.ContentType, out var mediaType))
RequestDelegateFactory.cs (2)
1389Log.UnexpectedJsonContentType(httpContext, httpContext.Request.ContentType, throwOnBadRequest); 1520Log.UnexpectedNonFormContentType(httpContext, httpContext.Request.ContentType, throwOnBadRequest);
Microsoft.AspNetCore.Http.Tests (1)
Internal\DefaultHttpRequestTests.cs (1)
58Assert.Null(request.ContentType);
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingMiddleware.cs (2)
155if (request.ContentType is null) 159else if (MediaTypeHelpers.TryGetEncodingForMediaType(request.ContentType,
Microsoft.AspNetCore.Mvc.Core (9)
ConsumesAttribute.cs (2)
114var requestContentType = context.HttpContext.Request.ContentType; 160var requestContentType = context.RouteContext.HttpContext.Request.ContentType;
Formatters\InputFormatter.cs (1)
55var contentType = context.HttpContext.Request.ContentType;
Formatters\TextInputFormatter.cs (2)
43context.HttpContext.Request.ContentType); 84var requestContentType = context.HttpContext.Request.ContentType;
ModelBinding\Binders\BodyModelBinder.cs (4)
146var message = Resources.FormatUnsupportedContentType(httpContext.Request.ContentType); 206var contentType = formatterContext.HttpContext.Request.ContentType; 218var contentType = formatterContext.HttpContext.Request.ContentType; 230var contentType = formatterContext.HttpContext.Request.ContentType;
Microsoft.AspNetCore.Mvc.Core.Test (3)
ModelBinding\FormFileValueProviderFactoryTest.cs (1)
105context.Setup(c => c.Request.ContentType).Returns("application/x-www-form-urlencoded");
ModelBinding\FormValueProviderFactoryTest.cs (1)
93context.Setup(c => c.Request.ContentType).Returns("application/x-www-form-urlencoded");
ModelBinding\JQueryFormValueProviderFactoryTest.cs (1)
178context.Setup(c => c.Request.ContentType).Returns("application/x-www-form-urlencoded");
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerInputFormatterTest.cs (1)
742request.SetupGet(f => f.ContentType).Returns(contentType);
XmlSerializerInputFormatterTest.cs (1)
678request.SetupGet(f => f.ContentType).Returns(contentType);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
NewtonsoftJsonInputFormatterTest.cs (1)
454httpContext.Setup(h => h.Request.ContentType).Returns("application/json");
NewtonsoftJsonPatchInputFormatterTest.cs (1)
262request.SetupGet(f => f.ContentType).Returns(contentType);
Microsoft.AspNetCore.Routing (2)
Matching\AcceptsMatcherPolicy.cs (2)
92var contentType = httpContext.Request.ContentType; 358var contentType = httpContext.Request.ContentType;