Skip to content

Instantly share code, notes, and snippets.

@ianrose14
Created August 30, 2016 14:18
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 ianrose14/6824da861daa6f1e1504fe375e97922b to your computer and use it in GitHub Desktop.
Save ianrose14/6824da861daa6f1e1504fe375e97922b to your computer and use it in GitHub Desktop.
package whatever
import (
"io/ioutil"
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
)
func init() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)
log.Debugf(ctx, "%s to %s", r.Method, r.URL)
log.Debugf(ctx, "Content-Length: %q", r.Header.Get("Content-Length"))
out, err := ioutil.ReadAll(r.Body)
if err != nil {
log.Debugf(ctx, "failed to read body: %s", err)
return
}
log.Debugf(ctx, "body (%d bytes): %s", len(out), string(out))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment