Render templates via a buffer, not the ResponseWriter (closes #123)
All checks were successful
check / check (push) Superseded by a newer commit; never tested

This commit was merged in pull request #131.
This commit is contained in:
2026-08-14 06:18:22 +02:00
parent 5f18bc3eae
commit 0b457ea713
3 changed files with 99 additions and 3 deletions

View File

@@ -1,6 +1,19 @@
package handlers
import "net/http"
import (
"html/template"
"net/http"
)
// AddTemplateForTest registers a template under a page name so that
// the handlers_test package can drive the render path with a
// template of its own.
func (s *Handlers) AddTemplateForTest(
pageTemplate string,
tmpl *template.Template,
) {
s.templates[pageTemplate] = tmpl
}
// RenderTemplateForTest exposes renderTemplate for use in the
// handlers_test package.