mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 15:10:13 +00:00
Limit HTTP request verbosity
This commit is contained in:
@@ -292,13 +292,20 @@ func (r *Requester) DoRequest(req *http.Request, method, path string, headers ma
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 && resp.StatusCode != 201 && resp.StatusCode != 202 {
|
||||
return fmt.Errorf("Error: HTTP Status code %s. Body: %s", resp.Status, contents)
|
||||
err = fmt.Errorf("unsuccessful HTTP status code: %d", resp.StatusCode)
|
||||
|
||||
if verbose {
|
||||
err = fmt.Errorf("%s\n%s", err.Error(),
|
||||
fmt.Sprintf("%s exchange raw response: %s", r.Name, string(contents)))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
resp.Body.Close()
|
||||
if verbose {
|
||||
log.Printf("HTTP status: %s, Code: %v", resp.Status, resp.StatusCode)
|
||||
log.Printf("%s exchange raw response: %s", r.Name, string(contents[:]))
|
||||
log.Printf("%s exchange raw response: %s", r.Name, string(contents))
|
||||
}
|
||||
|
||||
if result != nil {
|
||||
|
||||
Reference in New Issue
Block a user