From 40007fc11569e65493ac9aeec94d63216069fce8 Mon Sep 17 00:00:00 2001 From: lemmi Date: Fri, 24 Jan 2020 07:08:12 +0100 Subject: [PATCH] make use of more http-lib functions --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 7f9b2f4..17d6359 100644 --- a/main.go +++ b/main.go @@ -349,7 +349,7 @@ func cachedRender(rs *routeStats) http.HandlerFunc { var compressed bytes.Buffer return func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { - http.Error(w, "Not Allowed", http.StatusMethodNotAllowed) + http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } if strings.TrimLeft(r.URL.Path, "/") == "favicon.ico" { @@ -359,7 +359,7 @@ func cachedRender(rs *routeStats) http.HandlerFunc { return } if r.URL.Path != "/" { - http.Error(w, "Not Found", http.StatusNotFound) + http.NotFound(w, r) return }