HttpResponse.ContentType is marked as String but is null sometimes #42222
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
Status: Resolved
Is there an existing issue for this?
Describe the bug
In some cases, the value of
HttpResponse.ContentType
can benull
, but the property is defined asString
and notString?
.The problem is that, if we test whether
ContentType
isnull
, Intellisense complains that the value cannot benull
.Expected Behavior
Either one:
String?
.Steps To Reproduce
This is the minimal code to show the problem.
Implement an endpoint to catch
OPTIONS
request:Register the endpoint:
When the
OptionsRequest.ProcessAsync
method is called,Response .ContentType
isnull
.Exceptions (if any)
No response
.NET Version
6.0.6
Anything else?
ASP.NET Core 6.0.6
VS pro 17.2.4
dotnet --info:
The text was updated successfully, but these errors were encountered: