make use of more http-lib functions

This commit is contained in:
lemmi 2020-01-24 07:08:12 +01:00
parent b326aa66f5
commit 40007fc115
1 changed files with 2 additions and 2 deletions

View File

@ -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
}