Comparing version 0.0.12 to 0.0.13
@@ -21,3 +21,7 @@ 'use strict'; | ||
this._ttl = options.ttl || DEFAULT_TTL; | ||
// Successfully handshaked with the server. | ||
this._isConnected = false; | ||
this.methods = {}; | ||
this._existingMethods = []; | ||
@@ -31,3 +35,5 @@ cb = cb || function () {}; | ||
this._existingMethods = methods; | ||
this.register(methods); | ||
this._isConnected = true; | ||
return cb(null, this); | ||
@@ -53,3 +59,4 @@ }.bind(this)); | ||
var i = 0; | ||
var cb; | ||
var killed = false; | ||
var cb, publicMethodName, timeoutId; | ||
@@ -71,8 +78,14 @@ if (!methodName) { | ||
var publicMethodName = createPublicMethodName(this._name, methodName); | ||
if (this._isConnected && this._existingMethods.indexOf(methodName) === -1) { | ||
var err = new ServerError('invalidMethod', 'Remote method `' + methodName + '` does not exist'); | ||
if (cb) { | ||
return cb(err); | ||
} | ||
throw err; | ||
} | ||
var killed = false; | ||
publicMethodName = createPublicMethodName(this._name, methodName); | ||
if (cb) { | ||
var timeoutId = setTimeout(function () { | ||
timeoutId = setTimeout(function () { | ||
killed = true; | ||
@@ -79,0 +92,0 @@ cb(new ServerError('responseTimeout', |
{ | ||
"name": "bograch", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "A communication gateway for NodeJS microservices.", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -42,3 +42,4 @@ 'use strict'; | ||
var boClient = new Client(transporter, { | ||
name: 'test' | ||
name: 'test', | ||
ttl: 10 | ||
}); | ||
@@ -75,2 +76,9 @@ | ||
}); | ||
it('should return error if remote method does not exist', function (done) { | ||
boClient.call('lochNess', function (err) { | ||
expect(err.type).to.be.equal('invalidMethod'); | ||
done(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58195
19
482
3