Created
May 1, 2018 13:32
-
-
Save rzani/8d18d19cc6d7a644a422d41ac2e3a1da to your computer and use it in GitHub Desktop.
Print everything request's body
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 Post(w http.ResponseWriter, r *http.Request) { | |
var results []string | |
body, err := ioutil.readall(r.body) | |
if err != nil { | |
http.error(w, "error reading request body", | |
http.statusinternalservererror) | |
} | |
results = append(results, string(body)) | |
fmt.println(results) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment