func (ws *webServer) DelFlag(w http.ResponseWriter, r *http.Request) { _, name := path.Split(r.URL.Path) macStr := r.FormValue("mac") var machine datasource.Machine var exist bool if macStr != "" { mac, err := net.ParseMAC(macStr) if err != nil { http.Error(w, `{"error": "Error while parsing the mac"}`, http.StatusInternalServerError) return } machine, exist = ws.ds.GetMachine(mac) if !exist { http.Error(w, `{"error": "Machine not found"}`, http.StatusInternalServerError) return } } var err error if machine != nil { err = machine.DeleteFlag(name) } else { // TODO deafult flags http.Error(w, `{"error": "Default flags not supported yet"}`, http.StatusInternalServerError) } if err != nil { http.Error(w, `{"error": "Error while delleting value"}`, http.StatusInternalServerError) return } io.WriteString(w, `"OK"`) }