mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-02 07:26:53 +00:00
exchanges: Limit mock test JSON data size by truncating slices and maps (#1968)
* set limiter to first level mock data list and updated unit tests * address nested slices length limit * minor fix recording file and update unit tests * minor updates on unit tests * re-record mock files and minor fix on the unit tests ti adapt the mock data change * improve http recording limit value and fix issues with mock data in binance * added MockDataSliceLimit in request items and resolve minor unit test issues * resolve missed conflict * rename mock variables, resolve unit test issues, and other updates * minor fix to CheckJSON and update unit tests * minor unit test fix * further optimization on mock CheckJSON method, unit tests, and re-record poloniex * common and recording unit tests fix * minor linter issues fix * unit tests format fix * fix miscellaneous error * unit tests fix and minor docs update * re-record and reduce mock file size * indentation fix * minor assertion test fix * reverted log.Printf line in live testing * rename variables * update NewVCRServer unit test * replace string comparison with *net.OpError check * restructur net error test * exchanges/mock: Remove redundant error assertion message in TestNewVCRServer --------- Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -2513,12 +2513,13 @@ func (e *Exchange) SendHTTPRequest(ctx context.Context, ePath exchange.URL, path
|
||||
}
|
||||
err = e.SendPayload(ctx, f, func() (*request.Item, error) {
|
||||
return &request.Item{
|
||||
Method: http.MethodGet,
|
||||
Path: endpointPath + bybitAPIVersion + path,
|
||||
Result: response,
|
||||
Verbose: e.Verbose,
|
||||
HTTPDebugging: e.HTTPDebugging,
|
||||
HTTPRecording: e.HTTPRecording,
|
||||
Method: http.MethodGet,
|
||||
Path: endpointPath + bybitAPIVersion + path,
|
||||
Result: response,
|
||||
Verbose: e.Verbose,
|
||||
HTTPDebugging: e.HTTPDebugging,
|
||||
HTTPRecording: e.HTTPRecording,
|
||||
HTTPMockDataSliceLimit: e.HTTPMockDataSliceLimit,
|
||||
}, nil
|
||||
}, request.UnauthenticatedRequest)
|
||||
if err != nil {
|
||||
@@ -2576,14 +2577,15 @@ func (e *Exchange) SendAuthHTTPRequestV5(ctx context.Context, ePath exchange.URL
|
||||
}
|
||||
headers["X-BAPI-SIGN"] = hmacSignedStr
|
||||
return &request.Item{
|
||||
Method: method,
|
||||
Path: endpointPath + common.EncodeURLValues(path, params),
|
||||
Headers: headers,
|
||||
Body: bytes.NewBuffer(payload),
|
||||
Result: &response,
|
||||
Verbose: e.Verbose,
|
||||
HTTPDebugging: e.HTTPDebugging,
|
||||
HTTPRecording: e.HTTPRecording,
|
||||
Method: method,
|
||||
Path: endpointPath + common.EncodeURLValues(path, params),
|
||||
Headers: headers,
|
||||
Body: bytes.NewBuffer(payload),
|
||||
Result: &response,
|
||||
Verbose: e.Verbose,
|
||||
HTTPDebugging: e.HTTPDebugging,
|
||||
HTTPRecording: e.HTTPRecording,
|
||||
HTTPMockDataSliceLimit: e.HTTPMockDataSliceLimit,
|
||||
}, nil
|
||||
}, request.AuthenticatedRequest)
|
||||
if response.RetCode != 0 && response.RetMsg != "" {
|
||||
|
||||
Reference in New Issue
Block a user