-
Notifications
You must be signed in to change notification settings - Fork 3
Description
if you enter an non existing service name --> found would be never true; anti_recursive is counting up endless since an or || it will be always true i think it should be while (anti_recusive < 100 && !found);
/**
* Get service methods from grpc descriptor
*
* @param descriptor
* @param service
* @Protected
*/
getServiceMethods(descriptor: grpc.GrpcObject, service: string): Array
{
let anti_recusive = 0
let actualDescriptor : any = descriptor;
let found = false;
const path = this.generateServicePath(service);
do {
const service = path.pop();
if (service && service in actualDescriptor){
actualDescriptor = actualDescriptor[service];
found = true;
}
anti_recusive++;
}while(anti_recusive < 100 || !found);
if ('service' in actualDescriptor) {
return Object.entries(actualDescriptor.service)
.map(([methodName, methodDefinition]) => ({
name: methodName,
definition: methodDefinition as MethodDefinition<any, any>
}));
}
throw new ReflectionRequestException('Not found service');
}