Browse Source

updateTyp auf form-data umgestellt

pull/1/head
Georg Spar 1 year ago
parent
commit
265bcab8c2
  1. 12
      wdm.go

12
wdm.go

@ -183,12 +183,24 @@ func updateTypHandler(writer http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodOptions {
return
}
err := req.ParseMultipartForm(64 << 20)
if err != nil {
writer.WriteHeader(http.StatusBadRequest)
return
}
var typ Typ
if req.Form["bezeichnung"] != nil {
typ.Bezeichnung = req.FormValue("bezeichnung")
} else {
body, err := io.ReadAll(req.Body)
if err != nil {
writer.WriteHeader(http.StatusBadRequest)
}
var typ Typ
json.Unmarshal(body, &typ)
}
log.Println("Name = ", typ.Bezeichnung)
log.Info("updating Typ", typ.Bezeichnung)
res, err := UpdateTyp(typ)

Loading…
Cancel
Save