Created
February 21, 2018 18:45
-
-
Save eyeezzi/1b442380f30a81229eff439b093a8642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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