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

[HTTP/3] Add tests - HttpVersionPolicy.RequestVersionOrHigher #72357

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -757,10 +757,23 @@ public async Task Public_Interop_ExactVersion_BufferContent_Success(string uri)
Assert.NotEmpty(content);
}

[Theory]
[OuterLoop]
[MemberData(nameof(InteropUris))]
public Task Public_Interop_Upgrade_Request3OrLower_Success(string uri)
{
return Public_Interop_Upgrade_Core(uri, HttpVersion.Version30, HttpVersionPolicy.RequestVersionOrLower);
}

[Theory]
[OuterLoop]
[MemberData(nameof(InteropUris))]
public async Task Public_Interop_Upgrade_Success(string uri)
public Task Public_Interop_Upgrade_Request2OrHigher_Success(string uri)
{
return Public_Interop_Upgrade_Core(uri, HttpVersion.Version20, HttpVersionPolicy.RequestVersionOrHigher);
}

private async Task Public_Interop_Upgrade_Core(string uri, Version requestVersion, HttpVersionPolicy policy)
{
// Create the handler manually without passing in useVersion = Http3 to avoid using VersionHttpClientHandler,
// because it overrides VersionPolicy on each request with RequestVersionExact (bypassing Alt-Svc code path completely).
Expand All @@ -772,8 +785,8 @@ public async Task Public_Interop_Upgrade_Success(string uri)
{
Method = HttpMethod.Get,
RequestUri = new Uri(uri, UriKind.Absolute),
Version = HttpVersion.Version30,
VersionPolicy = HttpVersionPolicy.RequestVersionOrLower
Version = requestVersion,
VersionPolicy = policy
})
{
try
Expand All @@ -797,8 +810,8 @@ public async Task Public_Interop_Upgrade_Success(string uri)
{
Method = HttpMethod.Get,
RequestUri = new Uri(uri, UriKind.Absolute),
Version = HttpVersion.Version30,
VersionPolicy = HttpVersionPolicy.RequestVersionOrLower
Version = requestVersion,
VersionPolicy = policy
})
{
using HttpResponseMessage responseB = await client.SendAsync(requestB).WaitAsync(TimeSpan.FromSeconds(20));
Expand Down