Skip to content
Permalink
Browse files

[copy] The API isn't only used in `Jitsu` but also other applications…

… such as webops

[fix] Allow the powered by check to be overruled
  • Loading branch information...
3rd-Eden committed Nov 16, 2012
1 parent 796b75d commit ddd59337ac8275e3bd72c321a04318b9648f04ba
Showing with 5 additions and 5 deletions.
  1. +5 −5 node.js/lib/client/client.js
@@ -93,8 +93,8 @@ Client.prototype.request = function (method, uri /* variable arguments */) {
self.emit('debug::response', { statusCode: statusCode, result: result });

var poweredBy = response.headers['x-powered-by'];
if (!poweredBy || poweredBy.indexOf('Nodejitsu') === -1) {
error = new Error('Jitsu requires you to connect to Nodejitsu\'s stack (api.nodejitsu.com)');
if (!self.options.get('ignorePoweredBy') && !poweredBy || poweredBy.indexOf('Nodejitsu') === -1) {
error = new Error('The Nodejitsu-API requires you to connect the Nodejitsu\'s stack (api.nodejitsu.com)');
error.statusCode = 403;
error.result = "";
return callback(error);
@@ -176,18 +176,18 @@ Client.prototype.upload = function (uri, contentType, file, callback, success) {

success(response, result);
});

out.on('request', function(request) {
var buffer = 0;
request.on('socket', function(socket) {
request.on('socket', function(socket) {
var id = setInterval(function() {
var data = socket._bytesDispatched || (socket.socket && socket.socket._bytesDispatched);
emitter.emit('data', data - buffer);
buffer = data;
if(buffer >= stat.size) {
clearInterval(id);
emitter.emit('end');
}
}
},100);
});
});

0 comments on commit ddd5933

Please sign in to comment.
You can’t perform that action at this time.