Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
tests
  • Loading branch information
antonfirsov authored and github-actions committed Jan 4, 2022
commit 3d196b32cd009c7bbeee6dfbce0c8ab15f036434
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection()
}
}

[ConditionalFact(nameof(TestsEnabled))]
public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted()
[InlineData(false)]
[InlineData(true)]
[ConditionalTheory(nameof(TestsEnabled))]
public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool responseHasContentLength)
{
using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer())
using (HttpClient client = CreateHttpClient())
Expand All @@ -80,7 +82,14 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted()
int streamId = await connection.ReadRequestHeaderAsync();

// Response header.
await connection.SendDefaultResponseHeadersAsync(streamId);
if (responseHasContentLength)
{
await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) });
}
else
{
await connection.SendDefaultResponseHeadersAsync(streamId);
}

// Response data, missing Trailers.
await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes));
Expand All @@ -98,8 +107,10 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted()
}
}

[ConditionalFact(nameof(TestsEnabled))]
public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available()
[InlineData(false)]
[InlineData(true)]
[ConditionalTheory(nameof(TestsEnabled))]
public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available(bool responseHasContentLength)
{
using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer())
using (HttpClient client = CreateHttpClient())
Expand All @@ -111,7 +122,14 @@ public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Availab
int streamId = await connection.ReadRequestHeaderAsync();

// Response header.
await connection.SendDefaultResponseHeadersAsync(streamId);
if (responseHasContentLength)
{
await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) });
}
else
{
await connection.SendDefaultResponseHeadersAsync(streamId);
}

// Response data, missing Trailers.
await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,10 @@ public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection()
}
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted()
[InlineData(false)]
[InlineData(true)]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool responseHasContentLength)
{
using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer())
using (HttpClient client = CreateHttpClient())
Expand All @@ -850,7 +852,14 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted()
int streamId = await connection.ReadRequestHeaderAsync();

// Response header.
await connection.SendDefaultResponseHeadersAsync(streamId);
if (responseHasContentLength)
{
await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) });
}
else
{
await connection.SendDefaultResponseHeadersAsync(streamId);
}

// Response data, missing Trailers.
await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes));
Expand Down Expand Up @@ -888,8 +897,10 @@ public async Task Http2GetAsync_TrailerHeaders_TrailingPseudoHeadersThrow()
}
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available()
[InlineData(false)]
[InlineData(true)]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available(bool responseHasContentLength)
{
using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer())
using (HttpClient client = CreateHttpClient())
Expand All @@ -901,7 +912,14 @@ public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Availab
int streamId = await connection.ReadRequestHeaderAsync();

// Response header.
await connection.SendDefaultResponseHeadersAsync(streamId);
if (responseHasContentLength)
{
await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) });
}
else
{
await connection.SendDefaultResponseHeadersAsync(streamId);
}

// Response data, missing Trailers.
await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes));
Expand Down