mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 18:22:49 +08:00
Set status code directly (#608)
Makes it possible for middlewares to read status codes and handle errors
This commit is contained in:
parent
44f8e312a8
commit
f934620538
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user