1
0

In main.go made use of handler's Error func and in Error() func added missing WriteHeader().

This commit is contained in:
Alexander Andreev 2023-08-13 02:17:47 +04:00
parent 4523e5a622
commit 35b48d29e6
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 2 additions and 2 deletions

View File

@ -54,8 +54,7 @@ func main() {
r := httpr.New() r := httpr.New()
r.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) { r.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound) dwhttp.Error(w, http.StatusNotFound, "", "", r.Referer())
web.ErrorXXX("/ Not Found", "", "", r.Referer(), http.StatusNotFound, w)
} }
r.ServeStatic("/assets/*filepath", web.Assets()) r.ServeStatic("/assets/*filepath", web.Assets())

View File

@ -188,6 +188,7 @@ func SitemapXml(w http.ResponseWriter, r *http.Request) {
} }
func Error(w http.ResponseWriter, code int, reason, message, referer string) { func Error(w http.ResponseWriter, code int, reason, message, referer string) {
w.WriteHeader(code)
web.ErrorXXX("/ "+http.StatusText(code), reason, message, referer, code, w) web.ErrorXXX("/ "+http.StatusText(code), reason, message, referer, code, w)
} }