[Fixes #112] BaseView.ExecuteAsync disposes the response stream

This commit is contained in:
Kiran Challa 2015-07-13 10:55:06 -07:00
parent f7e7ce53a5
commit 8c8490fab4
5 changed files with 7 additions and 6 deletions

View File

@ -6,6 +6,7 @@ using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
@ -52,7 +53,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
Context = context;
Request = Context.Request;
Response = Context.Response;
Output = new StreamWriter(Response.Body);
Output = new StreamWriter(Response.Body, Encoding.UTF8, 4096, leaveOpen: true);
HtmlEncoder = context.ApplicationServices.GetHtmlEncoder();
await ExecuteAsync();
Output.Dispose();
@ -199,7 +200,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
/// <param name="value">The <see cref="object"/> to write.</param>
/// <remarks>
/// <see cref="HelperResult.WriteTo(TextWriter)"/> is invoked for <see cref="HelperResult"/> types.
/// For all other types, the encoded result of <see cref="object.ToString"/> is written to the
/// For all other types, the encoded result of <see cref="object.ToString"/> is written to the
/// <paramref name="writer"/>.
/// </remarks>
protected void WriteTo(TextWriter writer, object value)

View File

@ -51,7 +51,7 @@ using Views
#line 10 "CompilationErrorPage.cshtml"
Response.StatusCode = 500;
Response.ContentType = "text/html";
Response.ContentType = "text/html; charset=utf-8";
Response.ContentLength = null; // Clear any prior Content-Length
#line default

View File

@ -9,7 +9,7 @@
}
@{
Response.StatusCode = 500;
Response.ContentType = "text/html";
Response.ContentType = "text/html; charset=utf-8";
Response.ContentLength = null; // Clear any prior Content-Length
}
<!DOCTYPE html>

View File

@ -57,7 +57,7 @@ using Views
Response.StatusCode = 500;
// TODO: Response.ReasonPhrase = "Internal Server Error";
Response.ContentType = "text/html";
Response.ContentType = "text/html; charset=utf-8";
Response.ContentLength = null; // Clear any prior Content-Length
string location = string.Empty;

View File

@ -15,7 +15,7 @@
@{
Response.StatusCode = 500;
// TODO: Response.ReasonPhrase = "Internal Server Error";
Response.ContentType = "text/html";
Response.ContentType = "text/html; charset=utf-8";
Response.ContentLength = null; // Clear any prior Content-Length
string location = string.Empty;
}