diff --git a/integration/microservices/e2e/sum-grpc.spec.ts b/integration/microservices/e2e/sum-grpc.spec.ts index d292c3c2100..cc4dbe45a14 100644 --- a/integration/microservices/e2e/sum-grpc.spec.ts +++ b/integration/microservices/e2e/sum-grpc.spec.ts @@ -48,11 +48,16 @@ describe('GRPC transport', () => { ); }); - it(`GRPC Sending and Receiving HTTP POST`, () => { - return request(server) + it(`GRPC Sending and Receiving HTTP POST`, async () => { + await request(server) .post('/sum') .send([1, 2, 3, 4, 5]) .expect(200, { result: 15 }); + + await request(server) + .post('/upperMethod/sum') + .send([1, 2, 3, 4, 5]) + .expect(200, { result: 15 }); }); it(`GRPC Sending and Receiving HTTP POST (multiple proto)`, async () => { diff --git a/integration/microservices/src/grpc/grpc.controller.ts b/integration/microservices/src/grpc/grpc.controller.ts index e99d8d6c632..94b7c4f75d3 100644 --- a/integration/microservices/src/grpc/grpc.controller.ts +++ b/integration/microservices/src/grpc/grpc.controller.ts @@ -40,6 +40,14 @@ export class GrpcController { return svc.sum({ data }); } + // Test that getService generate both lower and uppercase method + @Post('upperMethod/sum') + @HttpCode(200) + callWithOptions(@Body() data: number[]): Observable { + const svc = this.client.getService('Math'); + return svc.Sum({ data }); + } + @GrpcMethod('Math') async sum({ data }: { data: number[] }): Promise { return of({ diff --git a/packages/microservices/client/client-grpc.ts b/packages/microservices/client/client-grpc.ts index 298a9e1524c..008bee4fa83 100644 --- a/packages/microservices/client/client-grpc.ts +++ b/packages/microservices/client/client-grpc.ts @@ -53,8 +53,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc { const grpcService = {} as T; protoMethods.forEach(m => { - const key = m[0].toLowerCase() + m.slice(1, m.length); - grpcService[key] = this.createServiceMethod(grpcClient, m); + grpcService[m] = this.createServiceMethod(grpcClient, m); }); return grpcService; }