Skip to content

Commit

Permalink
added .fetchImplementation hook to Exchange.js fix ccxt#976
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Dec 30, 2017
1 parent 1209a8a commit 298ba80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/base/Exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ module.exports = class Exchange {
this.substituteCommonCurrencyCodes = true // reserved
this.parseBalanceFromOpenOrders = false // some exchanges return balance updates from order API endpoints

this.fetchImplementation = fetch

this.timeout = 10000 // milliseconds
this.verbose = false
this.debug = false
Expand Down Expand Up @@ -275,7 +277,7 @@ module.exports = class Exchange {
this.executeRestRequest = function (url, method = 'GET', headers = undefined, body = undefined) {

let promise =
fetch (url, { 'method': method, 'headers': headers, 'body': body, 'agent': this.tunnelAgent || null, timeout: this.timeout})
this.fetchImplementation (url, { 'method': method, 'headers': headers, 'body': body, 'agent': this.tunnelAgent || null, timeout: this.timeout})
.catch (e => {
if (isNode)
throw new ExchangeNotAvailable ([ this.id, method, url, e.type, e.message ].join (' '))
Expand Down

0 comments on commit 298ba80

Please sign in to comment.