Properly log the request body

This commit is contained in:
Finn Herzfeld 2018-12-05 13:49:32 -08:00
parent dd7771d535
commit 3ac410c3df

View file

@ -2,7 +2,7 @@ package main;
import ( import (
"net/http" "net/http"
// "golang.org/x/net/html" "io/ioutil"
"database/sql" "database/sql"
_ "github.com/lib/pq" _ "github.com/lib/pq"
"os" "os"
@ -29,7 +29,10 @@ func main() {
}) })
http.HandleFunc("/v1/directory/reconcile", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/v1/directory/reconcile", func(w http.ResponseWriter, r *http.Request) {
log.Printf("%s", r.Body) b, err := ioutil.ReadAll(r.Body)
defer r.Body.Close()
crash(err)
log.Printf("%s", b)
}) })
log.Fatal(http.ListenAndServe(":8082", nil)) log.Fatal(http.ListenAndServe(":8082", nil))
} }