Skip to content

Commit

Permalink
feat: improve debug msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
amalucelli committed Dec 28, 2022
1 parent 77f2432 commit 6d6e1bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nextdns/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,11 @@ func (c *Client) newRequest(method string, path string, body interface{}) (*http
}
}
if c.Debug {
fmt.Printf("[DEBUG] REQUEST: Method:%s, URL:%s, Body:%v", method, u.String(), buf.String())
if buf.String() == "" {
fmt.Printf("[DEBUG] REQUEST: Method:%s, URL:%s\n", method, u.String())
} else {
fmt.Printf("[DEBUG] REQUEST: Method:%s, URL:%s, Body:%s\n", method, u.String(), strings.TrimSuffix(buf.String(), "\n"))
}
}
req, err = http.NewRequest(method, u.String(), buf)
if err != nil {
Expand Down

0 comments on commit 6d6e1bc

Please sign in to comment.