Print json response body

This commit is contained in:
Peter Stuifzand 2018-07-09 18:44:28 +02:00
parent 05d7c498c3
commit 4df4371256

View File

@ -21,6 +21,7 @@ import (
"encoding/json" "encoding/json"
"flag" "flag"
"fmt" "fmt"
"io"
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
@ -168,7 +169,8 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode == 200 { if resp.StatusCode == 200 {
dec := json.NewDecoder(resp.Body) input := io.TeeReader(resp.Body, os.Stderr)
dec := json.NewDecoder(input)
var authResponse authResponse var authResponse authResponse
err = dec.Decode(&authResponse) err = dec.Decode(&authResponse)
if err != nil { if err != nil {