diff --git a/gateway/server.go b/gateway/server.go index 4a5578ff4..a111f6c72 100644 --- a/gateway/server.go +++ b/gateway/server.go @@ -329,8 +329,9 @@ func createDescriptorSource(cli zrpc.Client, up Upstream) (grpcurl.DescriptorSou return source, nil } -// withDialer sets a dialer to create a gRPC client. -func withDialer(dialer func(conf zrpc.RpcClientConf) zrpc.Client) func(*Server) { +// WithDialer sets a dialer to create a gRPC client. +// This allows customization of gRPC client options, such as message size limits. +func WithDialer(dialer func(conf zrpc.RpcClientConf) zrpc.Client) func(*Server) { return func(s *Server) { s.dialer = dialer } diff --git a/gateway/server_test.go b/gateway/server_test.go index 7eff9eb47..dfb794658 100644 --- a/gateway/server_test.go +++ b/gateway/server_test.go @@ -54,7 +54,7 @@ func TestMustNewServer(t *testing.T) { c.Host = "localhost" c.Port = 18881 - s := MustNewServer(c, withDialer(func(conf zrpc.RpcClientConf) zrpc.Client { + s := MustNewServer(c, WithDialer(func(conf zrpc.RpcClientConf) zrpc.Client { return zrpc.MustNewClient(conf, zrpc.WithDialOption(grpc.WithContextDialer(dialer()))) }), WithHeaderProcessor(func(header http.Header) []string { return []string{"foo"}