All checks were successful
check / check (push) Successful in 3m48s
executeTemplate ran the template straight into the ResponseWriter, so a mid-render failure left the already-emitted prefix written and the response committed: the handler could no longer set a 500 and the client got a truncated page, typically with a 200. It also let handler tests pass against the flushed prefix of a page that aborted below the assertions. Execute into a bytes.Buffer instead, and set the content type and copy the buffer out only once rendering has fully succeeded. On failure nothing has been written, so the 500 still reaches the client. Add a test that renders a template failing partway through and asserts both the 500 and that the body carries no part of the aborted page. Against the previous streaming renderer it fails on both counts (200, body "PARTIAL PAGE CONTENTInternal server error").
1.2 KiB
1.2 KiB