diff --git a/codec.go b/codec.go index 44f16d5..70ef0b9 100644 --- a/codec.go +++ b/codec.go @@ -116,10 +116,12 @@ func (jsonCodec) Marshal(v interface{}) ([]byte, error) { } func (jsonCodec) Unmarshal(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } if pb, ok := v.(proto.Message); ok { return jsonpb.Unmarshal(b.NewReader(data), pb) } - return json.Unmarshal(data, v) } diff --git a/grpc.go b/grpc.go index e8e23a3..3d158ea 100644 --- a/grpc.go +++ b/grpc.go @@ -207,7 +207,7 @@ func (g *grpcClient) stream(ctx context.Context, node *registry.Node, req client ServerStreams: true, } - grpcCallOptions := []grpc.CallOption{} + grpcCallOptions := []grpc.CallOption{grpc.CallContentSubtype(cf.Name())} if opts := g.getGrpcCallOptions(); opts != nil { grpcCallOptions = append(grpcCallOptions, opts...) }