func ProfileUpload(cocs backend.Cocaine, w http.ResponseWriter, r *http.Request) { name := mux.Vars(r)["name"] defer r.Body.Close() body, _ := ioutil.ReadAll(r.Body) if len(body) == 0 { http.Error(w, "Empty profile", http.StatusInternalServerError) return } err := cocs.ProfileUpload(name, body) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } fmt.Fprintln(w, "OK") }