diff --git a/packages/grpc/src/comsumer/clients.ts b/packages/grpc/src/comsumer/clients.ts index 00e422b0be9..beb41169de6 100644 --- a/packages/grpc/src/comsumer/clients.ts +++ b/packages/grpc/src/comsumer/clients.ts @@ -115,7 +115,9 @@ export class GRPCClients extends Map { let genericFunctionName; switch (genericFunctionSelector) { case 0: - options.metadata.set('rpc.method.type', 'unary'); + if (! options.metadata.get('rpc.method.type')) { + options.metadata.set('rpc.method.type', 'unary'); + } genericFunctionName = new ClientUnaryRequest( client, originalFunction, @@ -123,7 +125,9 @@ export class GRPCClients extends Map { ); break; case 1: - options.metadata.set('rpc.method.type', 'server'); // server streaming + if (! options.metadata.get('rpc.method.type')) { + options.metadata.set('rpc.method.type', 'server'); // server streaming + } genericFunctionName = new ClientReadableRequest( client, originalFunction, @@ -131,7 +135,9 @@ export class GRPCClients extends Map { ); break; case 2: - options.metadata.set('rpc.method.type', 'client'); // client streaming + if (! options.metadata.get('rpc.method.type')) { + options.metadata.set('rpc.method.type', 'client'); // client streaming + } genericFunctionName = new ClientWritableRequest( client, originalFunction, @@ -139,7 +145,9 @@ export class GRPCClients extends Map { ); break; case 3: - options.metadata.set('rpc.method.type', 'bidi'); // bidirectional streaming + if (! options.metadata.get('rpc.method.type')) { + options.metadata.set('rpc.method.type', 'bidi'); // bidirectional streaming + } genericFunctionName = new ClientDuplexStreamRequest( client, originalFunction,