Can't set StatusCode after Response has started (#200)

This commit is contained in:
kinglionsoft 2018-01-16 15:10:52 +08:00 committed by Tom Pallister
parent 31f526d3cd
commit 0784954971

View File

@ -84,9 +84,12 @@ namespace Ocelot.Errors.Middleware
} }
private void SetInternalServerErrorOnResponse(HttpContext context) private void SetInternalServerErrorOnResponse(HttpContext context)
{
if (!context.Response.HasStarted)
{ {
context.Response.StatusCode = 500; context.Response.StatusCode = 500;
} }
}
private string CreateMessage(HttpContext context, Exception e) private string CreateMessage(HttpContext context, Exception e)
{ {