Update server to handle default schemes

This commit is contained in:
Michael Lumish 2020-04-21 10:32:58 -07:00
parent 0b522b2289
commit b6846f0709
1 changed files with 7 additions and 3 deletions

View File

@ -45,7 +45,7 @@ import {
} from './server-call';
import { ServerCredentials } from './server-credentials';
import { ChannelOptions } from './channel-options';
import { createResolver, ResolverListener } from './resolver';
import { createResolver, ResolverListener, mapUriDefaultScheme } from './resolver';
import { log } from './logging';
import {
SubchannelAddress,
@ -226,10 +226,14 @@ export class Server {
throw new TypeError('callback must be a function');
}
const portUri = parseUri(port);
if (portUri === null) {
const initialPortUri = parseUri(port);
if (initialPortUri === null) {
throw new Error(`Could not parse port "${port}"`);
}
const portUri = mapUriDefaultScheme(initialPortUri);
if (portUri === null) {
throw new Error(`Could not get a default scheme for port "${port}"`);
}
const serverOptions: http2.ServerOptions = {};
if ('grpc.max_concurrent_streams' in this.options) {