MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / DelHandler

Method DelHandler

protocol/http/http_server.go:51–66  ·  view source on GitHub ↗

DelHandler 支持http进行Delete

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

49
50// DelHandler 支持http进行Delete
51func (hs *HttpHandler) DelHandler(w http.ResponseWriter, r *http.Request) {
52 key := r.FormValue("key")
53 if key == "" {
54 http.Error(w, "key is empty", http.StatusBadRequest)
55 return
56 }
57 err := hs.Delete([]byte(key))
58 if err != nil {
59 http.Error(w, err.Error(), http.StatusInternalServerError)
60 return
61 }
62 _, err = w.Write([]byte("ok"))
63 if err != nil {
64 return
65 }
66}
67
68// GetHandler 支持http进行Get
69func (hs *HttpHandler) GetHandler(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 2

DeleteMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected