Skip to content
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
14 changes: 11 additions & 3 deletions src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2120,9 +2120,11 @@ await server.AcceptConnectionAsync(_ =>
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public async Task SendHttpPostRequest_WhenBufferingChanges_Success(bool buffering)
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public async Task SendHttpPostRequest_WhenBufferingChanges_Success(bool buffering, bool setContentLength)
{
byte[] randomData = Encoding.ASCII.GetBytes("Hello World!!!!\n");
await LoopbackServer.CreateClientAndServerAsync(
Expand All @@ -2132,6 +2134,12 @@ await LoopbackServer.CreateClientAndServerAsync(
HttpWebRequest request = WebRequest.CreateHttp(uri);
request.Method = "POST";
request.AllowWriteStreamBuffering = buffering;

if (setContentLength)
{
request.Headers.Add("content-length", size.ToString());
}

using var stream = await request.GetRequestStreamAsync();
for (int i = 0; i < size / randomData.Length; i++)
{
Expand Down