chore(): resolve conflicts

This commit is contained in:
Kamil Myśliwiec
2021-06-28 11:52:22 +02:00
2 changed files with 9 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ export interface ControllerOptions extends ScopeOptions, VersionOptions {
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
host?: string | string[];
host?: string | RegExp | Array<string | RegExp>;
}
/**

View File

@@ -101,7 +101,7 @@ export class RouterExplorer {
instanceWrapper: InstanceWrapper,
moduleKey: string,
applicationRef: T,
host: string | string[],
host: string | RegExp | Array<string | RegExp>,
routePathMetadata: RoutePathMetadata,
) {
const { instance } = instanceWrapper;
@@ -181,7 +181,7 @@ export class RouterExplorer {
instanceWrapper: InstanceWrapper,
moduleKey: string,
routePathMetadata: RoutePathMetadata,
host: string | string[],
host: string | RegExp | Array<string | RegExp>,
) {
(routeDefinitions || []).forEach(routeDefinition => {
const { version: methodVersion } = routeDefinition;
@@ -204,7 +204,7 @@ export class RouterExplorer {
instanceWrapper: InstanceWrapper,
moduleKey: string,
routePathMetadata: RoutePathMetadata,
host: string | string[],
host: string | RegExp | Array<string | RegExp>,
) {
const {
path: paths,
@@ -277,14 +277,17 @@ export class RouterExplorer {
});
}
private applyHostFilter(host: string | string[], handler: Function) {
private applyHostFilter(
host: string | RegExp | Array<string | RegExp>,
handler: Function,
) {
if (!host) {
return handler;
}
const httpAdapterRef = this.container.getHttpAdapterRef();
const hosts = Array.isArray(host) ? host : [host];
const hostRegExps = hosts.map((host: string) => {
const hostRegExps = hosts.map((host: string | RegExp) => {
const keys = [];
const regexp = pathToRegexp(host, keys);
return { regexp, keys };