Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HttpResponseMessage.Content non-nullable #35910

Merged
merged 2 commits into from
May 8, 2020

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub added this to the 5.0 milestone May 6, 2020
@ghost
Copy link

ghost commented May 6, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@davidsh
Copy link
Contributor

davidsh commented May 7, 2020

Do we need to change WinHttpHandler as well?

@stephentoub
Copy link
Member Author

Do we need to change WinHttpHandler as well?

This didn't actually change SocketsHttpHandler, just HttpResponseMessage.Content's getter.

Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, you might be already aware of, anyway just in case there is some test failures in Microsoft.Extensions.Http.Logging.RedactedLogValueIntegrationTest. seems related

@wfurt
Copy link
Member

wfurt commented May 7, 2020

probably use of EmptyContent.

     Expected: ···ve: innocuous value\n
     Actual:   ···ve: innocuous value\nContent-Length: 0\n

@stephentoub
Copy link
Member Author

probably use of EmptyContent

Yup. Thanks.

Copy link
Member

@safern safern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
@gewarren
Copy link
Contributor

gewarren commented Sep 3, 2021

@stephentoub As noted in dotnet/docs#25953, it appears that this is a breaking change. Can you confirm?

@stephentoub
Copy link
Member Author

Any bug fix can break something, but this doesn't qualify as a breaking change as far as our definition of the term applies. To my knowledge the behavior of this member was never documented as to when it returned null or didn't, and we don't consider returning non-null when we previously returned null to be a "breaking change", even though, yes, it could break code checking for null (just as we don't consider changing something that was returning instances of type A to instance return an instance of type B that derives from A to be breaking, even though it can of course break someone). On top of that, this would really only affect testing scenarios, as HttpResponseMessage.Content never returned null for responses coming back from HttpMessageHandler/SocketsHttpHandler/WinHttpHandler/etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HttpResponseMessage.Content nullable annotation is... annoying
7 participants