React to OnSendingHeaders rename.

This commit is contained in:
Chris R 2015-06-12 15:48:45 -07:00
parent 6dbbe831c4
commit ef4ab17700
2 changed files with 2 additions and 4 deletions

View File

@ -28,17 +28,15 @@ namespace Microsoft.AspNet.Diagnostics
public async Task Invoke(HttpContext context)
{
var responseStarted = false;
try
{
context.Response.OnSendingHeaders(state => responseStarted = true, null);
await _next(context);
}
catch (Exception ex)
{
_logger.LogError("An unhandled exception has occurred: " + ex.Message, ex);
// We can't do anything if the response has already started, just abort.
if (responseStarted)
if (context.Response.HasStarted)
{
_logger.LogWarning("The response has already started, the error handler will not be executed.");
throw;

View File

@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Diagnostics
}
// Do nothing if a response body has already been provided.
if (context.Response.HeadersSent
if (context.Response.HasStarted
|| context.Response.StatusCode < 400
|| context.Response.StatusCode >= 600
|| context.Response.ContentLength.HasValue