mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
bugfixes: Backtester credentials, Binance ExecutionLimits, Mock recording (#1539)
* fix mock recording, binance, backtester * minor credential streamlining
This commit is contained in:
@@ -47,9 +47,21 @@ func HTTPRecord(res *http.Response, service string, respContents []byte) error {
|
||||
}
|
||||
service = strings.ToLower(service)
|
||||
|
||||
fileout := filepath.Join(DefaultDirectory, service, service+".json")
|
||||
outputFilePath := filepath.Join(DefaultDirectory, service, service+".json")
|
||||
_, err := os.Stat(outputFilePath)
|
||||
if err != nil {
|
||||
if os.IsExist(err) {
|
||||
return err
|
||||
}
|
||||
// check alternative path to add compatibility with /internal/testing/exchange/exchange.go MockHTTPInstance
|
||||
outputFilePath = filepath.Join("..", service, "testdata", "http.json")
|
||||
_, err = os.Stat(outputFilePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
contents, err := os.ReadFile(fileout)
|
||||
contents, err := os.ReadFile(outputFilePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -227,7 +239,7 @@ func HTTPRecord(res *http.Response, service string, respContents []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return file.Write(fileout, payload)
|
||||
return file.Write(outputFilePath, payload)
|
||||
}
|
||||
|
||||
// GetFilteredHeader filters excluded http headers for insertion into a mock
|
||||
|
||||
Reference in New Issue
Block a user