gocheese.go | 7 +++++-- diff --git a/gocheese.go b/gocheese.go index f88e4e0861c5aba08b1fbf36c503df9314229fff8325229ce63509bd551861d1..048df5d8f97fcf956c7c8023a845c521656c13cf15501f2f365e2eb7b3e5ec43 100644 --- a/gocheese.go +++ b/gocheese.go @@ -359,7 +359,8 @@ } } func handler(w http.ResponseWriter, r *http.Request) { - if r.Method == "GET" { + switch r.Method { + case "GET": var path string var autorefresh bool if strings.HasPrefix(r.URL.Path, *norefreshURLPath) { @@ -383,8 +384,10 @@ } } else { servePkg(w, r, parts[0], parts[1]) } - } else if r.Method == "POST" { + case "POST": serveUpload(w, r) + default: + http.Error(w, "unknown action", http.StatusBadRequest) } }