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
|
var compressed bytes.Buffer
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != http.MethodGet {
|
if r.Method != http.MethodGet {
|
||||||
http.Error(w, "Not Allowed", http.StatusMethodNotAllowed)
|
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if strings.TrimLeft(r.URL.Path, "/") == "favicon.ico" {
|
if strings.TrimLeft(r.URL.Path, "/") == "favicon.ico" {
|
||||||
|
@ -359,7 +359,7 @@ func cachedRender(rs *routeStats) http.HandlerFunc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/" {
|
if r.URL.Path != "/" {
|
||||||
http.Error(w, "Not Found", http.StatusNotFound)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue