From 1a313715c87033380b80290453bf9ac8a86c84dd Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Mon, 7 May 2018 14:59:08 -0700 Subject: [PATCH] Merge fixup --- test/Kestrel.FunctionalTests/ResponseTests.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/Kestrel.FunctionalTests/ResponseTests.cs b/test/Kestrel.FunctionalTests/ResponseTests.cs index 7339aaf7ab..bc940be76b 100644 --- a/test/Kestrel.FunctionalTests/ResponseTests.cs +++ b/test/Kestrel.FunctionalTests/ResponseTests.cs @@ -1657,7 +1657,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests "", ""); - // Send an invalid chunk prefix to cause an error. + // Let the app finish + await connection.Send( + "1", + "a", + ""); + + await connection.Receive( + "HTTP/1.1 200 OK", + $"Date: {server.Context.DateHeaderValue}", + "Content-Length: 0", + "", + ""); + + // This will be consumed by Http1Connection when it attempts to + // consume the request body and will cause an error. await connection.Send( "gg"); @@ -1691,7 +1705,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests [Fact] public async Task Sending100ContinueDoesNotPreventAutomatic400Responses() { - var foundMessage = false; using (var server = new TestServer(httpContext => { return httpContext.Request.Body.ReadAsync(new byte[1], 0, 1); @@ -1729,7 +1742,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } } - Assert.True(foundMessage, "Expected log not found"); + Assert.Contains(TestApplicationErrorLogger.Messages, w => w.EventId.Id == 17 && w.LogLevel == LogLevel.Information && w.Exception is BadHttpRequestException + && ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); } [Fact]