-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add parsing of zero port for unknown Uri scheme #40986
Conversation
Tagging subscribers to this area: @dotnet/ncl |
[Fact] | ||
public static void ZeroPortIsParsedForBothKnownAndUnknownSchemes() | ||
{ | ||
Uri.TryCreate("http://example.com:0", UriKind.Absolute, out var uri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't the test be rather parametrized instead of copying similar block 3 times in a row?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last comment, otherwise LGTM. Thanks!
Assert.Equal(-1, uri.Port); | ||
Assert.True(uri.IsDefaultPort); | ||
Assert.Equal("rtsp://example.com/", uri.ToString()); | ||
yield return new object[] { "http://example.com:0", 0, false, "http://example.com:0/" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is toString
same as the uriString
except the trailing slash? Do we need the extra parameter?
Used Miha's suggestion from #37865 (comment)
Fixes #37865