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) { ...@@ -46,8 +46,16 @@ func (svc *Svc) SetValue(w http.ResponseWriter, r *http.Request) {
func (svc *Svc) DelValue(w http.ResponseWriter, r *http.Request) { func (svc *Svc) DelValue(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
id := vars["id"] id := vars["id"]
resp := fmt.Sprintf("Delete ID: %s\n", id) reply := make(chan vault.Message)
fmt.Fprint(w, resp) 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 - инициализировать маршрутизацию запросов // 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