mirror of https://github.com/grpc/grpc-node.git
Merge pull request #1852 from murgatroid99/grpc-js_bind_creds_typecheck
grpc-js: Tighten server.bindAsync creds typecheck
This commit is contained in:
commit
bd1571fa94
|
|
@ -237,8 +237,8 @@ export class Server {
|
|||
throw new TypeError('port must be a string');
|
||||
}
|
||||
|
||||
if (creds === null || typeof creds !== 'object') {
|
||||
throw new TypeError('creds must be an object');
|
||||
if (creds === null || !(creds instanceof ServerCredentials)) {
|
||||
throw new TypeError('creds must be a ServerCredentials object');
|
||||
}
|
||||
|
||||
if (typeof callback !== 'function') {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,11 @@ describe('Server', () => {
|
|||
|
||||
assert.throws(() => {
|
||||
server.bindAsync('localhost:0', null as any, noop);
|
||||
}, /creds must be an object/);
|
||||
}, /creds must be a ServerCredentials object/);
|
||||
|
||||
assert.throws(() => {
|
||||
server.bindAsync('localhost:0', grpc.credentials.createInsecure() as any, noop);
|
||||
}, /creds must be a ServerCredentials object/);
|
||||
|
||||
assert.throws(() => {
|
||||
server.bindAsync(
|
||||
|
|
|
|||
Loading…
Reference in New Issue