From 75e17e68cb2ae4ed9caa4b46249e2c8e8fefc1d5 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Thu, 14 Nov 2024 00:57:45 +0800 Subject: [PATCH] fix(grpc): meta merge --- packages/grpc/src/comsumer/clients.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/grpc/src/comsumer/clients.ts b/packages/grpc/src/comsumer/clients.ts index 165c5a16dc1..bd33af379b5 100644 --- a/packages/grpc/src/comsumer/clients.ts +++ b/packages/grpc/src/comsumer/clients.ts @@ -71,15 +71,16 @@ export class GRPCClients extends Map { connectionService[methodName] = ( clientOptions: IClientOptions = {} ) => { + const meta = new Metadata(); + meta.set('rpc.definition', definition); + meta.set('rpc.method', methodName); + if (clientOptions.metadata) { - const meta = new Metadata(); meta.merge(clientOptions.metadata); clientOptions.metadata = meta; } else { - clientOptions.metadata = new Metadata(); + clientOptions.metadata = meta; } - clientOptions.metadata.set('rpc.definition', definition); - clientOptions.metadata.set('rpc.method', methodName); return this.getClientRequestImpl( connectionService,