diff --git a/rpc/client/init.go b/rpc/client/init.go index be8d066..e7d4398 100644 --- a/rpc/client/init.go +++ b/rpc/client/init.go @@ -55,7 +55,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe StreamName: info.Name, ServerStreams: info.ServerStream(), ClientStreams: info.ClientStream(), - }, toMethodName(info)) + }, toMethodName(info), c.grpcCallOpts...) if err != nil { cancel() return nil, err diff --git a/rpc/client/options.go b/rpc/client/options.go index 5711cd4..755b88b 100644 --- a/rpc/client/options.go +++ b/rpc/client/options.go @@ -24,6 +24,7 @@ type cfg struct { tlsCfg *tls.Config grpcDialOpts []grpc.DialOption + grpcCallOpts []grpc.CallOption conn Conn } @@ -127,3 +128,10 @@ func WithGRPCDialOptions(opts []grpc.DialOption) Option { c.grpcDialOpts = append(c.grpcDialOpts, opts...) } } + +// WithGRPCDialOptions returns an option to specify grpc.Call. +func WithGRPCCallOptions(opts []grpc.CallOption) Option { + return func(c *cfg) { + c.grpcCallOpts = append(c.grpcCallOpts, opts...) + } +}