Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeouts correction #50

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions kraken.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function KrakenClient(key, secret, otp) {
key: key,
secret: secret,
otp: otp,
timeoutMS: 5000
timeoutMS: 0
};

/**
Expand Down Expand Up @@ -121,17 +121,17 @@ function KrakenClient(key, secret, otp) {
// Set custom User-Agent string
headers['User-Agent'] = 'Kraken Javascript API Client';

var options = {
let options = {
url: url,
method: 'POST',
headers: headers,
form: params,
timeout: config.timeoutMS
};

var req = request.post(options, function(error, response, body) {
let req = request.post(options, function(error, response, body) {
if(typeof callback === 'function') {
var data;
let data;

if(error) {
return callback.call(self, new Error('Error in server response: ' + JSON.stringify(error)), null);
Expand All @@ -146,7 +146,7 @@ function KrakenClient(key, secret, otp) {
//If any errors occured, Kraken will give back an array with error strings under
//the key "error". We should then propagate back the error message as a proper error.
if(data.error && data.error.length) {
var krakenError = null;
let krakenError = null;
data.error.forEach(function(element) {
if (element.charAt(0) === "E") {
krakenError = element.substr(1);
Expand Down