Fix more test failures caused by connection resets

- Avoid sending data that won't be processed.
This commit is contained in:
Stephen Halter 2016-11-02 11:15:37 -07:00
parent 6cbbb73ca7
commit 8591900849
1 changed files with 7 additions and 9 deletions

View File

@ -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]