Add httputil.DumpRequestOut & httputil.DumpResponse to SendPayload (#298)

* First pass adding DumpResponse

* WIP

* Added httpDebug flag to SendPayload

* anx -> coinbase converted

* HTTPDebug flag added to all exchanges

* Updated Alphapoint:

* reworded error message

* Corrected itbit and huobihadax sendpayload

* Removed setting of default value

* don't return body for response as we already get this in verbose mode

* body is now included based on verbose setting

* WIP

* Due to issues with DumpResponse and gzip decoding use raw response from exchange for body output Also adds gzip decoding back as bug fix for OK group exchange

* removed additional new line

* Added URL path to dumpbody display as well
This commit is contained in:
Andrew
2019-05-16 13:46:28 +10:00
committed by Adrian Gallagher
parent 166761454f
commit 5bce701d43
39 changed files with 196 additions and 95 deletions

View File

@@ -138,6 +138,7 @@ func (g *Gemini) Setup(exch *config.ExchangeConfig) {
g.SetHTTPClientUserAgent(exch.HTTPUserAgent)
g.RESTPollingDelay = exch.RESTPollingDelay
g.Verbose = exch.Verbose
g.HTTPDebugging = exch.HTTPDebugging
g.BaseCurrencies = exch.BaseCurrencies
g.AvailablePairs = exch.AvailablePairs
g.EnabledPairs = exch.EnabledPairs
@@ -490,7 +491,7 @@ func (g *Gemini) PostHeartbeat() (string, error) {
// SendHTTPRequest sends an unauthenticated request
func (g *Gemini) SendHTTPRequest(path string, result interface{}) error {
return g.SendPayload(http.MethodGet, path, nil, nil, result, false, false, g.Verbose)
return g.SendPayload(http.MethodGet, path, nil, nil, result, false, false, g.Verbose, g.HTTPDebugging)
}
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request to the
@@ -528,7 +529,7 @@ func (g *Gemini) SendAuthenticatedHTTPRequest(method, path string, params map[st
headers["X-GEMINI-SIGNATURE"] = common.HexEncodeToString(hmac)
headers["Cache-Control"] = "no-cache"
return g.SendPayload(method, g.APIUrl+"/v1/"+path, headers, strings.NewReader(""), result, true, false, g.Verbose)
return g.SendPayload(method, g.APIUrl+"/v1/"+path, headers, strings.NewReader(""), result, true, false, g.Verbose, g.HTTPDebugging)
}
// GetFee returns an estimate of fee based on type of transaction