Revert "fixed write header bug in case of errors in index html (#4185)"

This reverts commit 8af820e60e.
This commit is contained in:
Gabe Kangas
2025-02-11 18:36:00 -08:00
parent 10e5683bd3
commit 7b88b1099d

View File

@@ -108,15 +108,9 @@ func renderIndexHtml(w http.ResponseWriter, nonce string) {
return
}
// Use a buffer to ensure that we do not write a partial response header before checking for errors
var buf bytes.Buffer
if err := index.Execute(&buf, content); err != nil {
if err := index.Execute(w, content); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
_, _ = w.Write(buf.Bytes())
}
// MetadataPage represents a server-rendered web page for bots and web scrapers.