mirror of https://github.com/grpc/grpc-node.git
Add original name aliases for generated client methods
This commit is contained in:
parent
e9c2476a19
commit
ffa1d649b0
|
@ -912,6 +912,9 @@ exports.makeClientConstructor = function(methods, serviceName,
|
|||
}
|
||||
// Associate all provided attributes with the method
|
||||
_.assign(ServiceClient.prototype[name], attrs);
|
||||
if (attrs.originalName) {
|
||||
ServiceClient.prototype[attrs.originalName] = ServiceClient.prototype[name];
|
||||
}
|
||||
});
|
||||
|
||||
ServiceClient.service = methods;
|
||||
|
|
|
@ -215,6 +215,10 @@ describe('Client constructor building', function() {
|
|||
grpc.makeGenericClientConstructor(illegal_service_attrs);
|
||||
}, /\$/);
|
||||
});
|
||||
it('Should add aliases for original names', function() {
|
||||
var Client = grpc.makeGenericClientConstructor(mathServiceAttrs);
|
||||
assert.strictEqual(Client.prototype.add, Client.prototype.Add);
|
||||
});
|
||||
});
|
||||
describe('waitForClientReady', function() {
|
||||
var server;
|
||||
|
|
Loading…
Reference in New Issue