Permalink
Browse files

[minor] Allow the timeout to be customized, the web interface needs t…

…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...
1 parent 5a82b63 commit 2aabe1d7802269f00e7c6ed4e2ee110136e2d1a5 @3rd-Eden 3rd-Eden committed Oct 1, 2012
Showing with 10 additions and 10 deletions.
  1. +10 −10 node.js/lib/client/client.js
@@ -24,7 +24,7 @@ var Client = exports.Client = function (options) {
if (typeof this.options.get !== 'function') {
this.options.get = function (key) {
return this[key];
- }
+ };
}
};
@@ -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),
@@ -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;
}
@@ -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`.
//

0 comments on commit 2aabe1d

Please sign in to comment.