aspnetcore
aspnetcore copied to clipboard
Complete inner Pipewriter in HttpLoggingMiddleware
Fixes https://github.com/dotnet/aspnetcore/issues/39317. When replacing the Body feature in HttpLoggingMiddleware with a new IHttpResponseBodyFeature that wraps the original PipeWriter used by gRPC (or whoever), the implicit flush that happens in Kestrel doesn't wind up flushing the original PipeWriter. This causes Responses sent by gRPC to be silently swallowed. Instead we explicitly complete the original PipeWriter after receiving the response.
Still thinking about how to add a test for this.
Also adds new API to allow completing the PipeWriter on a StreamResponseBodyFeature:
public class StreamResponseBodyFeature
{
+ public async Task CompleteWriterAsync()
}