Skip to content

Do not expose HttpResponseMessage.Content == null to user code #386

Closed

Description

@dougbu

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.

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.

Activity

  1. self-assigned this
    on Feb 13, 2023
  2. dougbu commented on Feb 13, 2023

    @dougbu
    ContributorAuthor

    Anything to add @Tratcher or @stephentoub❔

  3. stephentoub commented on Feb 13, 2023

    @stephentoub

    Sounds fine.

  4. added a commit that references this issue on Feb 17, 2023
    979e6ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions