Skip to content

Commit

Permalink
[HTTP/3] Add tests - HttpVersionPolicy.RequestVersionOrHigher (#72357)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm authored Jul 18, 2022
1 parent 3e5f0c1 commit 5cbbdba
Showing 1 changed file with 18 additions and 5 deletions.
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

0 comments on commit 5cbbdba

Please sign in to comment.