Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
conch| in trace mode, stop dumping the request and response structs. …
Browse files Browse the repository at this point in the history
…they are needless noise

(cherry picked from commit 020648a)
  • Loading branch information
sungo committed Mar 8, 2019
1 parent c71ab3f commit 1874e62
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions pkg/conch/sling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
)
}
}
}
Expand All @@ -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)
Expand Down

0 comments on commit 1874e62

Please sign in to comment.