Browse Source

Merge pull request #694 from himyxia/inprove_switch_case

better way to handler switch case
pull/697/head
Chris Lu 7 years ago
committed by GitHub
parent
commit
7e76a7d21b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      weed/server/volume_server_handlers.go

10
weed/server/volume_server_handlers.go

@ -23,19 +23,13 @@ security settings:
func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
stats.ReadRequest()
vs.GetOrHeadHandler(w, r)
case "HEAD":
case "GET", "HEAD":
stats.ReadRequest()
vs.GetOrHeadHandler(w, r)
case "DELETE":
stats.DeleteRequest()
vs.guard.WhiteList(vs.DeleteHandler)(w, r)
case "PUT":
stats.WriteRequest()
vs.guard.WhiteList(vs.PostHandler)(w, r)
case "POST":
case "PUT", "POST":
stats.WriteRequest()
vs.guard.WhiteList(vs.PostHandler)(w, r)
}

Loading…
Cancel
Save