diff --git a/src/Servers/HttpSys/src/FeatureContext.cs b/src/Servers/HttpSys/src/FeatureContext.cs index c1f116c2b1..4d04d945a2 100644 --- a/src/Servers/HttpSys/src/FeatureContext.cs +++ b/src/Servers/HttpSys/src/FeatureContext.cs @@ -400,7 +400,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys set { _responseHeaders = value; } } - bool IHttpResponseFeature.HasStarted => Response.HasStarted; + bool IHttpResponseFeature.HasStarted => _responseStarted; void IHttpResponseFeature.OnStarting(Func callback, object state) { diff --git a/src/Servers/HttpSys/test/FunctionalTests/ResponseBodyTests.cs b/src/Servers/HttpSys/test/FunctionalTests/ResponseBodyTests.cs index 4a45a81a5d..bd73e39946 100644 --- a/src/Servers/HttpSys/test/FunctionalTests/ResponseBodyTests.cs +++ b/src/Servers/HttpSys/test/FunctionalTests/ResponseBodyTests.cs @@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys return Task.CompletedTask; }); await httpContext.Response.StartAsync(); + Assert.True(httpContext.Response.HasStarted); Assert.True(httpContext.Response.Headers.IsReadOnly); await startingTcs.Task.WithTimeout(); await httpContext.Response.WriteAsync("Hello World"); @@ -58,6 +59,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys return Task.CompletedTask; }); await httpContext.Response.CompleteAsync(); + Assert.True(httpContext.Response.HasStarted); Assert.True(httpContext.Response.Headers.IsReadOnly); await startingTcs.Task.WithTimeout(); await responseReceived.Task.WithTimeout();