A good pattern I've since found to take care of this is to have a func(w http.ResponseWriter, req *http.Request) error
handler signature, and keep track of whether the response writer has been written to. See here.
Resolved a while ago in commit 431bb22d
.
Calling it after the header has been written (likely with the wrong content-type) is incorrect and shouldn't be done.