diff --git a/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs b/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs index 4f325f4d38..2c47fad114 100644 --- a/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs +++ b/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs @@ -38,12 +38,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public override void Flush() { - throw new NotSupportedException(); } public override Task FlushAsync(CancellationToken cancellationToken) { - throw new NotSupportedException(); + return Task.CompletedTask; } public override long Seek(long offset, SeekOrigin origin) diff --git a/test/Kestrel.Core.Tests/HttpRequestStreamTests.cs b/test/Kestrel.Core.Tests/HttpRequestStreamTests.cs index 98c3d7ef68..8bff09b8a7 100644 --- a/test/Kestrel.Core.Tests/HttpRequestStreamTests.cs +++ b/test/Kestrel.Core.Tests/HttpRequestStreamTests.cs @@ -98,17 +98,18 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests #endif [Fact] - public void FlushThrows() + // Read-only streams should support Flush according to https://github.com/dotnet/corefx/pull/27327#pullrequestreview-98384813 + public void FlushDoesNotThrow() { var stream = new HttpRequestStream(Mock.Of()); - Assert.Throws(() => stream.Flush()); + stream.Flush(); } [Fact] - public async Task FlushAsyncThrows() + public async Task FlushAsyncDoesNotThrow() { var stream = new HttpRequestStream(Mock.Of()); - await Assert.ThrowsAsync(() => stream.FlushAsync()); + await stream.FlushAsync(); } [Fact]