@@ -8,7 +8,7 @@ const METHOD_CONTEXT_INDEX = Symbol.for('EggPrototype#controller#method#context'
88const METHOD_MIDDLEWARES = Symbol . for ( 'EggPrototype#method#middlewares' ) ;
99const METHOD_ACL = Symbol . for ( 'EggPrototype#method#acl' ) ;
1010
11- type METHOD_MAP = Map < string , ControllerTypeLike > ;
11+ type METHOD_MAP = Map < string , ControllerTypeLike | string [ ] > ;
1212type MethodContextIndexMap = Map < string , number > ;
1313type MethodMiddlewareMap = Map < string , MiddlewareFunc [ ] > ;
1414type MethodAclMap = Map < string , string | undefined > ;
@@ -21,7 +21,7 @@ export default class MethodInfoUtil {
2121
2222 static getMethodControllerType ( clazz : EggProtoImplClass , methodName : string ) : ControllerTypeLike | undefined {
2323 const methodControllerMap : METHOD_MAP | undefined = MetadataUtil . getMetaData ( METHOD_CONTROLLER_TYPE_MAP , clazz ) ;
24- return methodControllerMap ?. get ( methodName ) ;
24+ return methodControllerMap ?. get ( methodName ) as ControllerTypeLike | undefined ;
2525 }
2626
2727 static setMethodContextIndexInArgs ( index : number , clazz : EggProtoImplClass , methodName : string ) {
@@ -60,13 +60,13 @@ export default class MethodInfoUtil {
6060 return methodAclMap ?. get ( methodName ) ;
6161 }
6262
63- static setMethodHost ( host : string , clazz : EggProtoImplClass , methodName : string ) {
63+ static setMethodHosts ( hosts : string [ ] , clazz : EggProtoImplClass , methodName : string ) {
6464 const methodControllerMap : METHOD_MAP = MetadataUtil . initOwnMapMetaData ( METHOD_CONTROLLER_HOST , clazz , new Map ( ) ) ;
65- methodControllerMap . set ( methodName , host ) ;
65+ methodControllerMap . set ( methodName , hosts ) ;
6666 }
6767
68- static getMethodHost ( clazz : EggProtoImplClass , methodName : string ) : string | undefined {
68+ static getMethodHosts ( clazz : EggProtoImplClass , methodName : string ) : string [ ] | undefined {
6969 const methodControllerMap : METHOD_MAP | undefined = MetadataUtil . getMetaData ( METHOD_CONTROLLER_HOST , clazz ) ;
70- return methodControllerMap ?. get ( methodName ) ;
70+ return methodControllerMap ?. get ( methodName ) as string [ ] | undefined ;
7171 }
7272}
0 commit comments