From 4162da3a06c59f3cc4640e59fa55b28a01636181 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Sat, 29 Apr 2023 15:59:26 +0200 Subject: [PATCH] Force Content-Type to text/html when rendering a template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By chance, i found out that sometimes Go returned a Content-Type header of text/plain for some responses to HTMx request. Go’s documentation for http.ResponseWriter.Write sheds some light to this issue: > If the Header does not contain a Content-Type line, Write adds a > Content-Type set to the result of passing the initial 512 bytes of > written data to DetectContentType. http.DetectContentType has “sniff signatures” for the most common HTML elements, such as `