Skip to content

Commit

Permalink
[minor] Allow the timeout to be customized, the web interface needs t…
Browse files Browse the repository at this point in the history
…o have a more sensible default.

In addition to this fix, I added a missing semi-colon and the white space was automatically fixed by VIM
  • Loading branch information
3rd-Eden committed Oct 1, 2012
1 parent 5a82b63 commit 2aabe1d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions node.js/lib/client/client.js
Expand Up @@ -24,7 +24,7 @@ var Client = exports.Client = function (options) {
if (typeof this.options.get !== 'function') {
this.options.get = function (key) {
return this[key];
}
};
}

};
Expand All @@ -38,9 +38,9 @@ util.inherits(Client, EventEmitter);
// #### @body {Object} **optional** JSON Request Body
// #### @callback {function} Continuation to call if errors occur.
// #### @success {function} Continuation to call upon successful transactions
// Makes a request to `this.remoteUri + uri` using `method` and any
// Makes a request to `this.remoteUri + uri` using `method` and any
// `body` (JSON-only) if supplied. Short circuits to `callback` if the response
// code from Nodejitsu matches `failCodes`.
// code from Nodejitsu matches `failCodes`.
//
Client.prototype.request = function (method, uri /* variable arguments */) {
var options, args = Array.prototype.slice.call(arguments),
Expand All @@ -57,16 +57,16 @@ Client.prototype.request = function (method, uri /* variable arguments */) {
'Authorization': 'Basic ' + encoded,
'Content-Type': 'application/json'
},
timeout: 8 * 60 * 1000
timeout: this.options.get('timeout') || 8 * 60 * 1000
};

if (body) {
options.body = JSON.stringify(body);
}
}
else if (method !== 'GET') {
options.body = '{}';
}

if (proxy) {
options.proxy = proxy;
}
Expand Down Expand Up @@ -112,13 +112,13 @@ Client.prototype.request = function (method, uri /* variable arguments */) {
};

//
// ### function upload (uri, contentType, file, callback, success)
// ### function upload (uri, contentType, file, callback, success)
// #### @uri {Array} Locator for the Remote Resource
// #### @contentType {string} Content-Type header to use for the upload.
// #### @file {string} Path of the local file to upload.
// #### @file {string} Path of the local file to upload.
// #### @success {function} Continuation to call upon successful transactions
// #### @callback {function} Continuation to call if errors occur.
// Makes a `POST` request to `this.remoteUri + uri` with the data in `file`
// Makes a `POST` request to `this.remoteUri + uri` with the data in `file`
// as the request body. Short circuits to `callback` if the response
// code from Nodejitsu matches `failCodes`.
//
Expand Down

0 comments on commit 2aabe1d

Please sign in to comment.