1 override of ContentType
Microsoft.AspNetCore.Http (1)
Internal\DefaultHttpRequest.cs (1)
144public override string? ContentType
39 references to ContentType
Aspire.Dashboard (3)
Otlp\Http\OtlpHttpEndpointsBuilder.cs (3)
107logger.LogDebug("OTLP HTTP request with unsupported content type '{ContentType}' was rejected. Only '{SupportedContentType}' is supported.", httpContext.Request.ContentType, ProtobufContentType); 114Message: $"Content type '{httpContext.Request.ContentType}' is not supported. Only '{ProtobufContentType}' is supported."); 142var contentType = GetKnownContentType(context.Request.ContentType, out var charSet);
Microsoft.AspNetCore.Components.Endpoints (2)
RazorComponentEndpointInvoker.cs (2)
210if (context.Request.ContentType is not null && MediaTypeHeaderValue.TryParse(context.Request.ContentType, out var type))
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.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\aspnetcore\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.Abstractions (5)
HttpRequest.cs (1)
176public string? ContentType => _request.ContentType;
src\aspnetcore\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)
373if (!MediaTypeHeaderValue.TryParse(request.ContentType, out var mt)) 406throw 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)
1401Log.UnexpectedJsonContentType(httpContext, httpContext.Request.ContentType, throwOnBadRequest); 1554Log.UnexpectedNonFormContentType(httpContext, httpContext.Request.ContentType, throwOnBadRequest);
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingMiddleware.cs (2)
159if (request.ContentType is null) 163else if (MediaTypeHelpers.TryGetEncodingForMediaType(request.ContentType,
Microsoft.AspNetCore.Identity (1)
_generated\0\GeneratedRouteBuilderExtensions.g.cs (1)
1406logOrThrowExceptionHelper.UnexpectedJsonContentType(httpContext.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.Routing (2)
Matching\AcceptsMatcherPolicy.cs (2)
92var contentType = httpContext.Request.ContentType; 358var contentType = httpContext.Request.ContentType;