|
|
@ -71,17 +71,28 @@ func createTypHandler(writer http.ResponseWriter, req *http.Request) { |
|
|
|
if req.Method == http.MethodOptions { |
|
|
|
if req.Method == http.MethodOptions { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
log.Info(req) |
|
|
|
|
|
|
|
req.ParseForm() |
|
|
|
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") |
|
|
|
for formKey, formValue := range req.Form { |
|
|
|
for formKey, formValue := range req.Form { |
|
|
|
log.WithFields(log.Fields{formKey: formValue}).Info("parsing from Form: ") |
|
|
|
log.WithFields(log.Fields{formKey: formValue}).Info("parsing from Form: ") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
body, err := io.ReadAll(req.Body) |
|
|
|
body, err := io.ReadAll(req.Body) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
writer.WriteHeader(http.StatusBadRequest) |
|
|
|
writer.WriteHeader(http.StatusBadRequest) |
|
|
|
} |
|
|
|
} |
|
|
|
var typ Typ |
|
|
|
var typ Typ |
|
|
|
json.Unmarshal(body, &typ) |
|
|
|
json.Unmarshal(body, &typ) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.Println(typ) |
|
|
|
log.Println(typ) |
|
|
|
log.Println("Name= ", typ.Bezeichnung) |
|
|
|
log.Println("Name= ", typ.Bezeichnung) |
|
|
|
log.Info("creating new Typ", typ.Bezeichnung) |
|
|
|
log.Info("creating new Typ", typ.Bezeichnung) |
|
|
|