X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gocheese.go;h=a11e03f04d0a398efd1c1d24f9437ea0142def0a;hb=099686a6455463aa6ccba141da1481c82fdb0cec;hp=3c6d1521a754d06edbce07a85fd72cb5f14f23b0;hpb=d0729b9a07e45b8a45efacd00cb0a080f858d240;p=gocheese.git diff --git a/gocheese.go b/gocheese.go index 3c6d152..a11e03f 100644 --- a/gocheese.go +++ b/gocheese.go @@ -359,7 +359,8 @@ func serveUpload(w http.ResponseWriter, r *http.Request) { } 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 @@ func handler(w http.ResponseWriter, r *http.Request) { } 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) } }