Skip to content

Instantly share code, notes, and snippets.

@rzani
Created May 1, 2018 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rzani/8d18d19cc6d7a644a422d41ac2e3a1da to your computer and use it in GitHub Desktop.
Save rzani/8d18d19cc6d7a644a422d41ac2e3a1da to your computer and use it in GitHub Desktop.
Print everything request's body
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