aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-03 14:34:13 +0200
committerTeddy Wing2017-06-03 14:34:13 +0200
commitbd2d890a9ad1128bf25b560fc4d796249c4ed495 (patch)
tree54d8fe332c132cf041ef77584b0bfc564f97f9bc /main.go
parent288da883a3a4a91fec67029b7695ec03099cfc46 (diff)
downloadtimetasker-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.
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.go b/main.go
index 1cc56c7..2f82643 100644
--- a/main.go
+++ b/main.go
@@ -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)