Set status code directly (#608)

Makes it possible for middlewares to read status codes and handle errors
This commit is contained in:
Erik Juhlin 2018-09-12 08:34:39 +02:00 committed by Tom Pallister
parent 44f8e312a8
commit f934620538

View File

@ -43,14 +43,7 @@ namespace Ocelot.Responder
AddHeaderIfDoesntExist(context, new Header("Content-Length", new []{ response.Content.Headers.ContentLength.ToString() }) ); AddHeaderIfDoesntExist(context, new Header("Content-Length", new []{ response.Content.Headers.ContentLength.ToString() }) );
} }
context.Response.OnStarting(state => context.Response.StatusCode = (int)response.StatusCode;
{
var httpContext = (HttpContext)state;
httpContext.Response.StatusCode = (int)response.StatusCode;
return Task.CompletedTask;
}, context);
using(content) using(content)
{ {