File tree 1 file changed +11
-3
lines changed
src/libraries/System.Net.Requests/tests
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2120,9 +2120,11 @@ await server.AcceptConnectionAsync(_ =>
2120
2120
}
2121
2121
2122
2122
[ Theory ]
2123
- [ InlineData ( true ) ]
2124
- [ InlineData ( false ) ]
2125
- public async Task SendHttpPostRequest_WhenBufferingChanges_Success ( bool buffering )
2123
+ [ InlineData ( true , true ) ]
2124
+ [ InlineData ( true , false ) ]
2125
+ [ InlineData ( false , true ) ]
2126
+ [ InlineData ( false , false ) ]
2127
+ public async Task SendHttpPostRequest_WhenBufferingChanges_Success ( bool buffering , bool setContentLength )
2126
2128
{
2127
2129
byte [ ] randomData = Encoding . ASCII . GetBytes ( "Hello World!!!!\n " ) ;
2128
2130
await LoopbackServer . CreateClientAndServerAsync (
@@ -2132,6 +2134,12 @@ await LoopbackServer.CreateClientAndServerAsync(
2132
2134
HttpWebRequest request = WebRequest . CreateHttp ( uri ) ;
2133
2135
request . Method = "POST" ;
2134
2136
request . AllowWriteStreamBuffering = buffering ;
2137
+
2138
+ if ( setContentLength )
2139
+ {
2140
+ request . Headers . Add ( "content-length" , size . ToString ( ) ) ;
2141
+ }
2142
+
2135
2143
using var stream = await request . GetRequestStreamAsync ( ) ;
2136
2144
for ( int i = 0 ; i < size / randomData . Length ; i ++ )
2137
2145
{
You can’t perform that action at this time.
0 commit comments