Skip to content

Commit a0c8830

Browse files
Workaround http.sys bug in ResponseBodyTests for Content-Length header (#64960)
1 parent 387505c commit a0c8830

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Servers/HttpSys/test/FunctionalTests/ResponseBodyTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public async Task ResponseBody_WriteContentLength_PassedThrough()
212212
using (Utilities.CreateHttpServer(out address, async httpContext =>
213213
{
214214
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
215-
httpContext.Response.Headers["Content-lenGth"] = " 30 ";
215+
httpContext.Response.Headers["Content-lenGth"] = "30";
216216
Stream stream = httpContext.Response.Body;
217217
stream.EndWrite(stream.BeginWrite(new byte[10], 0, 10, null, null));
218218
stream.Write(new byte[10], 0, 10);
@@ -236,7 +236,7 @@ public async Task ResponseBody_WriteContentLengthNoneWritten_Throws()
236236
string address;
237237
using (Utilities.CreateHttpServer(out address, httpContext =>
238238
{
239-
httpContext.Response.Headers["Content-lenGth"] = " 20 ";
239+
httpContext.Response.Headers["Content-lenGth"] = "20";
240240
return Task.FromResult(0);
241241
}, LoggerFactory))
242242
{
@@ -250,7 +250,7 @@ public async Task ResponseBody_WriteContentLengthNotEnoughWritten_Throws()
250250
string address;
251251
using (Utilities.CreateHttpServer(out address, httpContext =>
252252
{
253-
httpContext.Response.Headers["Content-lenGth"] = " 20 ";
253+
httpContext.Response.Headers["Content-lenGth"] = "20";
254254
return httpContext.Response.Body.WriteAsync(new byte[5], 0, 5);
255255
}, LoggerFactory))
256256
{
@@ -265,7 +265,7 @@ public async Task ResponseBody_WriteContentLengthTooMuchWritten_Throws()
265265
string address;
266266
using (Utilities.CreateHttpServer(out address, async httpContext =>
267267
{
268-
httpContext.Response.Headers["Content-lenGth"] = " 10 ";
268+
httpContext.Response.Headers["Content-lenGth"] = "10";
269269
await httpContext.Response.Body.WriteAsync(new byte[5], 0, 5);
270270
await Assert.ThrowsAsync<InvalidOperationException>(() =>
271271
httpContext.Response.Body.WriteAsync(new byte[6], 0, 6));
@@ -286,7 +286,7 @@ public async Task ResponseBody_WriteContentLengthExtraWritten_Throws()
286286
try
287287
{
288288
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
289-
httpContext.Response.Headers["Content-lenGth"] = " 10 ";
289+
httpContext.Response.Headers["Content-lenGth"] = "10";
290290
httpContext.Response.Body.Write(new byte[10], 0, 10);
291291
httpContext.Response.Body.Write(new byte[9], 0, 9);
292292
requestThrew.SetResult(false);

0 commit comments

Comments
 (0)