HTTP Content-Type für HTML-Seiten explizit setzen
This commit is contained in:
@@ -11,6 +11,7 @@ func (a *App) renderTemplate(w http.ResponseWriter, path string, data any) {
|
|||||||
http.Error(w, "template parse failed", http.StatusInternalServerError)
|
http.Error(w, "template parse failed", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
if err := tmpl.Execute(w, data); err != nil {
|
if err := tmpl.Execute(w, data); err != nil {
|
||||||
http.Error(w, "template render failed", http.StatusInternalServerError)
|
http.Error(w, "template render failed", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user