Do not expose `HttpResponseMessage.Content == null` to user code
dougbu opened this issue · 2 comments
dougbu commented
In recent (5.0 and newer) .NET runtimes, Content==null
is impossible for user code to see. Even in older runtimes, HttpClient
would never leave Content==null
either.
- see dotnet/runtime@b48900f for the 5.0 change
Public code in this repo both exposes Content==null
(inconsistently) and expects (mostly in tests) to see that state. Bad enough we expose that state but it being inconsistent (depending on the runtime version) makes things worse.
The action here is to change our code to both remove the inconsistencies i.e., have Content!=null
everywhere regardless of the runtime version and update our expectations to handle Content!=null
. This includes reverting tests removed on net6.0
in #384.
dougbu commented
Anything to add @Tratcher or @stephentoub❔
stephentoub commented
Sounds fine.