Skip to content

Commit 6a119cc

Browse files
authored
use Response.WriteAsync instead of HttpResponseStreamWriter (#32735)
1 parent 94b7c9a commit 6a119cc

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/Mvc/Mvc.Core/src/ContentResult.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,7 @@ async Task IResult.ExecuteAsync(HttpContext httpContext)
8282
if (Content != null)
8383
{
8484
response.ContentLength = resolvedContentTypeEncoding.GetByteCount(Content);
85-
86-
await using (var textWriter = new HttpResponseStreamWriter(response.Body, resolvedContentTypeEncoding))
87-
{
88-
await textWriter.WriteAsync(Content);
89-
90-
// Flushing the HttpResponseStreamWriter does not flush the underlying stream. This just flushes
91-
// the buffered text in the writer.
92-
// We do this rather than letting dispose handle it because dispose would call Write and we want
93-
// to call WriteAsync.
94-
await textWriter.FlushAsync();
95-
}
85+
await response.WriteAsync(Content, resolvedContentTypeEncoding);
9686
}
9787
}
9888
}

0 commit comments

Comments
 (0)