Commit 2545a8e7 by lancet

all methods are working

parent b9df27c0
No preview for this file type
......@@ -46,8 +46,16 @@ func (svc *Svc) SetValue(w http.ResponseWriter, r *http.Request) {
func (svc *Svc) DelValue(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
resp := fmt.Sprintf("Delete ID: %s\n", id)
fmt.Fprint(w, resp)
reply := make(chan vault.Message)
msg := vault.Message{Action: "DEL", Reply: reply, Key: id}
svc.exchange <- msg
resp := <-reply
if resp.Error != true {
fmt.Fprint(w, "OK")
return
}
w.WriteHeader(http.StatusBadRequest)
fmt.Fprint(w, "FAILURE")
}
// InitRouter - инициализировать маршрутизацию запросов
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment