From 1874e6208fb757e17335158a80a642543dd64f17 Mon Sep 17 00:00:00 2001 From: sungo Date: Wed, 6 Mar 2019 16:13:15 -0500 Subject: [PATCH] conch| in trace mode, stop dumping the request and response structs. they are needless noise (cherry picked from commit 020648a175c74631a94afaea1cf85a7124ebafd5) --- pkg/conch/sling.go | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/pkg/conch/sling.go b/pkg/conch/sling.go index dc5b4b8..d643d83 100644 --- a/pkg/conch/sling.go +++ b/pkg/conch/sling.go @@ -107,25 +107,21 @@ func (c *Conch) get(url string, data interface{}) error { func (c *Conch) httpDo(req *http.Request, data interface{}) (*http.Response, error) { - if c.Trace { - c.ddp(req) - } else { - c.debugLog(fmt.Sprintf( - "Request: %s %s", - req.Method, - req.URL, - )) - - if (req.Method == "POST") && (req.Body != nil) { - if read, err := req.GetBody(); err == nil { - if bodyBytes, err := ioutil.ReadAll(read); err == nil { - c.debugLog( - fmt.Sprintf( - " Request Body: %s", - string(bodyBytes), - ), - ) - } + c.debugLog(fmt.Sprintf( + "Request: %s %s", + req.Method, + req.URL, + )) + + if (req.Method == "POST") && (req.Body != nil) { + if read, err := req.GetBody(); err == nil { + if bodyBytes, err := ioutil.ReadAll(read); err == nil { + c.debugLog( + fmt.Sprintf( + " Request Body: %s", + string(bodyBytes), + ), + ) } } } @@ -135,10 +131,6 @@ func (c *Conch) httpDo(req *http.Request, data interface{}) (*http.Response, err return res, err } - if c.Trace { - c.ddp(res) - } - defer res.Body.Close() bodyBytes, err := ioutil.ReadAll(res.Body)