mirror of https://github.com/grpc/grpc-node.git
Merge pull request #799 from murgatroid99/native_generic_client_fix
Native: fix generic Client constructor crashing
This commit is contained in:
commit
1addf78d49
|
@ -376,12 +376,14 @@ function Client(address, credentials, options) {
|
|||
}
|
||||
self.$interceptors = options.interceptors || [];
|
||||
self.$interceptor_providers = options.interceptor_providers || [];
|
||||
Object.keys(self.$method_definitions).forEach(method_name => {
|
||||
const method_definition = self.$method_definitions[method_name];
|
||||
self[method_name].interceptors = client_interceptors
|
||||
.resolveInterceptorProviders(self.$interceptor_providers, method_definition)
|
||||
.concat(self.$interceptors);
|
||||
});
|
||||
if (self.$method_definitions) {
|
||||
Object.keys(self.$method_definitions).forEach(method_name => {
|
||||
const method_definition = self.$method_definitions[method_name];
|
||||
self[method_name].interceptors = client_interceptors
|
||||
.resolveInterceptorProviders(self.$interceptor_providers, method_definition)
|
||||
.concat(self.$interceptors);
|
||||
});
|
||||
}
|
||||
|
||||
this.$callInvocationTransformer = options.callInvocationTransformer;
|
||||
|
||||
|
|
|
@ -220,6 +220,13 @@ describe('Client constructor building', function() {
|
|||
assert.strictEqual(Client.prototype.add, Client.prototype.Add);
|
||||
});
|
||||
});
|
||||
describe('Generic client', function() {
|
||||
it('Should construct without error', function() {
|
||||
assert.doesNotThrow(() => {
|
||||
const client = new grpc.Client('localhost: 50051', grpc.credentials.createInsecure());
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('waitForClientReady', function() {
|
||||
var server;
|
||||
var port;
|
||||
|
@ -314,7 +321,7 @@ describe('Echo service', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
describe('Generic client and server', function() {
|
||||
describe('Non-protobuf client and server', function() {
|
||||
function toString(val) {
|
||||
return val.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue