Skip to content

Instantly share code, notes, and snippets.

@eyeezzi
Created February 21, 2018 18:45
Show Gist options
  • Select an option

  • Save eyeezzi/1b442380f30a81229eff439b093a8642 to your computer and use it in GitHub Desktop.

Select an option

Save eyeezzi/1b442380f30a81229eff439b093a8642 to your computer and use it in GitHub Desktop.
func uploadHandler(w http.ResponseWriter, r *http.Request) {
var img Image
body, err := ioutil.ReadAll(r.Body)
// if err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// return
// }
if err = json.Unmarshal(body, &img); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
// fmt.Println(string(body))
fmt.Fprintln(w, "done")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment