make use of more http-lib functions
This commit is contained in:
parent
b326aa66f5
commit
40007fc115
4
main.go
4
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue