Created
August 30, 2016 14:18
-
-
Save ianrose14/6824da861daa6f1e1504fe375e97922b to your computer and use it in GitHub Desktop.
This file contains 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
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