diff --git a/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs b/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs index b35f6914f81d..c39ec7edd6e9 100644 --- a/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs +++ b/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs @@ -69,7 +69,7 @@ IEnumerator IEnumerable.GetEnumerator() internal string ToStringWithoutPreamble() => ToString().Substring(LogPreamble.Length); - internal static string EscapedValueOrEmptyMarker(string potentialValue) + internal static string EscapedValueOrEmptyMarker(string? potentialValue) // Encode space as + => potentialValue?.Length > 0 ? potentialValue.Replace(' ', '+') : EmptyEntry; diff --git a/src/Http/Http.Abstractions/src/HttpRequest.cs b/src/Http/Http.Abstractions/src/HttpRequest.cs index 33f8a9ed8f9d..189fdc739b01 100644 --- a/src/Http/Http.Abstractions/src/HttpRequest.cs +++ b/src/Http/Http.Abstractions/src/HttpRequest.cs @@ -96,7 +96,7 @@ public abstract class HttpRequest /// Gets or sets the Content-Type header. /// /// The Content-Type header. - public abstract string ContentType { get; set; } + public abstract string? ContentType { get; set; } /// /// Gets or sets the request body . diff --git a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt b/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt index 0676a6f9f794..687f1f1e034b 100644 --- a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt @@ -4,6 +4,7 @@ *REMOVED*Microsoft.AspNetCore.Routing.RouteValueDictionary.TryAdd(string! key, object! value) -> bool *REMOVED*static Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.UseMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder! app, System.Type! middleware, params object![]! args) -> Microsoft.AspNetCore.Builder.IApplicationBuilder! *REMOVED*static Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.UseMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder! app, params object![]! args) -> Microsoft.AspNetCore.Builder.IApplicationBuilder! +*REMOVED*abstract Microsoft.AspNetCore.Http.HttpRequest.ContentType.get -> string! Microsoft.AspNetCore.Http.IResult Microsoft.AspNetCore.Http.IResult.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task! Microsoft.AspNetCore.Http.Metadata.IFromBodyMetadata @@ -18,6 +19,7 @@ Microsoft.AspNetCore.Http.Metadata.IFromServiceMetadata Microsoft.AspNetCore.Http.Endpoint.Endpoint(Microsoft.AspNetCore.Http.RequestDelegate? requestDelegate, Microsoft.AspNetCore.Http.EndpointMetadataCollection? metadata, string? displayName) -> void Microsoft.AspNetCore.Http.Endpoint.RequestDelegate.get -> Microsoft.AspNetCore.Http.RequestDelegate? Microsoft.AspNetCore.Routing.RouteValueDictionary.TryAdd(string! key, object? value) -> bool +abstract Microsoft.AspNetCore.Http.HttpRequest.ContentType.get -> string? static Microsoft.AspNetCore.Builder.UseExtensions.Use(this Microsoft.AspNetCore.Builder.IApplicationBuilder! app, System.Func! middleware) -> Microsoft.AspNetCore.Builder.IApplicationBuilder! static Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.UseMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder! app, System.Type! middleware, params object?[]! args) -> Microsoft.AspNetCore.Builder.IApplicationBuilder! static Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.UseMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder! app, params object?[]! args) -> Microsoft.AspNetCore.Builder.IApplicationBuilder! diff --git a/src/Http/Http/src/Internal/DefaultHttpRequest.cs b/src/Http/Http/src/Internal/DefaultHttpRequest.cs index e47030909806..9c54c0883d58 100644 --- a/src/Http/Http/src/Internal/DefaultHttpRequest.cs +++ b/src/Http/Http/src/Internal/DefaultHttpRequest.cs @@ -146,7 +146,7 @@ public override IRequestCookieCollection Cookies set { RequestCookiesFeature.Cookies = value; } } - public override string ContentType + public override string? ContentType { get { return Headers.ContentType; } set { Headers.ContentType = value; } diff --git a/src/Middleware/HttpLogging/src/MediaTypeHelpers.cs b/src/Middleware/HttpLogging/src/MediaTypeHelpers.cs index 0537d682286b..80ebd49ccdb7 100644 --- a/src/Middleware/HttpLogging/src/MediaTypeHelpers.cs +++ b/src/Middleware/HttpLogging/src/MediaTypeHelpers.cs @@ -20,7 +20,7 @@ internal static class MediaTypeHelpers Encoding.Latin1 // TODO allowed by default? Make this configurable? }; - public static bool TryGetEncodingForMediaType(string contentType, List mediaTypeList, [NotNullWhen(true)] out Encoding? encoding) + public static bool TryGetEncodingForMediaType(string? contentType, List mediaTypeList, [NotNullWhen(true)] out Encoding? encoding) { encoding = null; if (mediaTypeList == null || mediaTypeList.Count == 0 || string.IsNullOrEmpty(contentType)) @@ -28,7 +28,10 @@ public static bool TryGetEncodingForMediaType(string contentType, List