export WithUnaryClientInterceptor
This commit is contained in:
@@ -60,14 +60,26 @@ func TestDepositServer_Deposit(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
directClient := MustNewClient(RpcClientConf{
|
||||
Endpoints: []string{"foo"},
|
||||
App: "foo",
|
||||
Token: "bar",
|
||||
Timeout: 1000,
|
||||
}, WithDialOption(grpc.WithInsecure()), WithDialOption(grpc.WithContextDialer(dialer())))
|
||||
directClient := MustNewClient(
|
||||
RpcClientConf{
|
||||
Endpoints: []string{"foo"},
|
||||
App: "foo",
|
||||
Token: "bar",
|
||||
Timeout: 1000,
|
||||
},
|
||||
WithDialOption(grpc.WithInsecure()),
|
||||
WithDialOption(grpc.WithContextDialer(dialer())),
|
||||
WithUnaryClientInterceptor(func(ctx context.Context, method string, req, reply interface{},
|
||||
cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
return invoker(ctx, method, req, reply, cc, opts...)
|
||||
}),
|
||||
)
|
||||
targetClient, err := NewClientWithTarget("foo", WithDialOption(grpc.WithInsecure()),
|
||||
WithDialOption(grpc.WithContextDialer(dialer())))
|
||||
WithDialOption(grpc.WithContextDialer(dialer())), WithUnaryClientInterceptor(
|
||||
func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn,
|
||||
invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
return invoker(ctx, method, req, reply, cc, opts...)
|
||||
}))
|
||||
assert.Nil(t, err)
|
||||
clients := []Client{
|
||||
directClient,
|
||||
|
||||
Reference in New Issue
Block a user