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

@@ -87,6 +87,7 @@ func (a *ANX) Setup(exch *config.ExchangeConfig) {
a.SetHTTPClientUserAgent(exch.HTTPUserAgent)
a.RESTPollingDelay = exch.RESTPollingDelay
a.Verbose = exch.Verbose
a.HTTPDebugging = exch.HTTPDebugging
a.BaseCurrencies = exch.BaseCurrencies
a.AvailablePairs = exch.AvailablePairs
a.EnabledPairs = exch.EnabledPairs
@@ -402,7 +403,7 @@ func (a *ANX) GetDepositAddressByCurrency(currency, name string, newAddr bool) (
// SendHTTPRequest sends an unauthenticated HTTP request
func (a *ANX) SendHTTPRequest(path string, result interface{}) error {
return a.SendPayload(http.MethodGet, path, nil, nil, result, false, false, a.Verbose)
return a.SendPayload(http.MethodGet, path, nil, nil, result, false, false, a.Verbose, a.HTTPDebugging)
}
// SendAuthenticatedHTTPRequest sends a authenticated HTTP request
@@ -435,7 +436,7 @@ func (a *ANX) SendAuthenticatedHTTPRequest(path string, params map[string]interf
headers["Rest-Sign"] = common.Base64Encode(hmac)
headers["Content-Type"] = "application/json"
return a.SendPayload(http.MethodPost, a.APIUrl+path, headers, bytes.NewBuffer(PayloadJSON), result, true, true, a.Verbose)
return a.SendPayload(http.MethodPost, a.APIUrl+path, headers, bytes.NewBuffer(PayloadJSON), result, true, true, a.Verbose, a.HTTPDebugging)
}
// GetFee returns an estimate of fee based on type of transaction