Fix more test failures caused by connection resets
- Avoid sending data that won't be processed.
This commit is contained in:
parent
6cbbb73ca7
commit
8591900849
|
|
@ -340,15 +340,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
[Fact]
|
||||
public async Task SingleErrorResponseSentWhenAppSwallowsBadRequestException()
|
||||
{
|
||||
BadHttpRequestException readException = null;
|
||||
|
||||
using (var server = new TestServer(async httpContext =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
|
||||
}
|
||||
catch (BadHttpRequestException)
|
||||
{
|
||||
}
|
||||
readException = await Assert.ThrowsAsync<BadHttpRequestException>(
|
||||
async () => await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1));
|
||||
}, new TestServiceContext()))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -357,8 +354,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
"POST / HTTP/1.1",
|
||||
"Transfer-Encoding: chunked",
|
||||
"",
|
||||
"g",
|
||||
"");
|
||||
"gg");
|
||||
await connection.ReceiveForcedEnd(
|
||||
"HTTP/1.1 400 Bad Request",
|
||||
"Connection: close",
|
||||
|
|
@ -368,6 +364,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
"");
|
||||
}
|
||||
}
|
||||
|
||||
Assert.NotNull(readException);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue