diff options
author | Teddy Wing | 2017-06-03 14:34:13 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-03 14:34:13 +0200 |
commit | bd2d890a9ad1128bf25b560fc4d796249c4ed495 (patch) | |
tree | 54d8fe332c132cf041ef77584b0bfc564f97f9bc | |
parent | 288da883a3a4a91fec67029b7695ec03099cfc46 (diff) | |
download | timetasker-bd2d890a9ad1128bf25b560fc4d796249c4ed495.tar.bz2 |
main.go: Print HTTP response bodies for debugging
Previously we were just printing the headers. Now print the bodies to
allow us to inspect the result.
Will probably want to add some handling that messages the user about
authentication problems.
-rw-r--r-- | main.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2,7 +2,7 @@ package main import ( // "fmt" - // "io/ioutil" + "io/ioutil" "log" // "os" "time" @@ -35,6 +35,10 @@ func main() { } log.Printf("%+v\n", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + log.Println(string(body)) + time_entry := timetask.NewTimeEntry( config.Profile, config.Projects["example"], @@ -48,6 +52,10 @@ func main() { } log.Printf("%+v\n", resp) + defer resp.Body.Close() + body, err = ioutil.ReadAll(resp.Body) + log.Println(string(body)) + // if len(os.Args) == 1 { // fmt.Println("Not enough arguments") // os.Exit(1) |