pub async fn render_500_middleware(
__arg0: State<Render500State>,
req: Request,
next: Next,
) -> Response<Body>Expand description
Middleware that intercepts plain-text 500 responses and re-renders them
through the configured server_error_template (or the embedded default
when enabled). Already-HTML 500 responses pass through untouched — those
were rendered by CatchPanicLayer (panics) or by the handler itself.
This closes the gap where a handler returning
Err((StatusCode::INTERNAL_SERVER_ERROR, msg)) previously produced a
raw plain-text response instead of the configured 500 page. The
on_server_error hook also fires for these paths, with the response
body bytes as the error message and the request URI as the path.