mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Fix possible null reference
This commit is contained in:
parent
01dbc34eb1
commit
f97e27f0c0
@ -39,7 +39,7 @@ export class CallCredentialsFilter extends BaseFilter implements Filter {
|
||||
if (splitPath.length >= 2) {
|
||||
serviceName = splitPath[1];
|
||||
}
|
||||
const hostname = splitHostPort(stream.getHost()).host;
|
||||
const hostname = splitHostPort(stream.getHost())?.host ?? 'localhost';
|
||||
/* Currently, call credentials are only allowed on HTTPS connections, so we
|
||||
* can assume that the scheme is "https" */
|
||||
this.serviceUrl = `https://${hostname}/${serviceName}`;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user