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

Throw ArgumentNull instead of NullReference for null requests #53742

Merged
merged 2 commits into from
Jun 7, 2021

Conversation

MihaZupan
Copy link
Member

@MihaZupan MihaZupan commented Jun 4, 2021

If someone inherits from HttpClientHandler and calls into base Send/SendAsync with a null request, they would see a NRE (since null checks happen in HttpClient).
The only test around this was for DiagnosticsHandler.
This PR adds the null checks to underlying handlers and moves the test to the default HttpClientHandler.

When experimenting around DiagnosticsHandler, this test was annoying me since SocketsHttpHandler didn't have a null check and it's kind of arbitrary that the test exists only for 1 handler.

@MihaZupan MihaZupan added this to the 6.0.0 milestone Jun 4, 2021
@ghost
Copy link

ghost commented Jun 4, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

If someone inherits from HttpClientHandler and calls into base Send/SendAsync with a null request, they would see a NRE.
The only test around this was for DiagnosticsHandler.
This PR adds the null checks to underlying handlers and moves the test to the default HttpClientHandler.

Author: MihaZupan
Assignees: -
Labels:

area-System.Net.Http

Milestone: 6.0.0

@MihaZupan MihaZupan requested a review from a team June 4, 2021 19:34
Copy link
Contributor

@alnikola alnikola left a comment

Choose a reason for hiding this comment

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

LGTM

@MihaZupan MihaZupan merged commit d1b5a34 into dotnet:main Jun 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2021
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.

2 participants