(writer http.ResponseWriter, request *http.Request)
| 6 | ) |
| 7 | |
| 8 | func ProcessFormData(writer http.ResponseWriter, request *http.Request) { |
| 9 | if (request.Method == http.MethodPost) { |
| 10 | index, _ := strconv.Atoi(request.PostFormValue("index")) |
| 11 | p := Product {} |
| 12 | p.Name = request.PostFormValue("name") |
| 13 | p.Category = request.PostFormValue("category") |
| 14 | p.Price, _ = strconv.ParseFloat(request.PostFormValue("price"), 64) |
| 15 | Products[index] = p |
| 16 | } |
| 17 | http.Redirect(writer, request, "/templates", http.StatusTemporaryRedirect) |
| 18 | } |
| 19 | |
| 20 | func init() { |
| 21 | http.HandleFunc("/forms/edit", ProcessFormData) |
nothing calls this directly
no outgoing calls
no test coverage detected