[backend/middleware] Fix HTML error pages not working intermittently

This commit is contained in:
Laura Hausmann 2024-10-11 06:44:48 +02:00
parent 3a346d5a22
commit 8071b5c6ea
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -166,7 +166,7 @@ public class ErrorHandlerMiddleware(
{ {
var model = new ErrorPageModel(payload); var model = new ErrorPageModel(payload);
ctx.Response.ContentType = "text/html; charset=utf8"; ctx.Response.ContentType = "text/html; charset=utf8";
var stream = ctx.Response.Body; var stream = ctx.Response.BodyWriter.AsStream();
await razor.RenderToStreamAsync("Shared/ErrorPage.cshtml", model, stream); await razor.RenderToStreamAsync("Shared/ErrorPage.cshtml", model, stream);
return; return;
} }