diff --git a/benchmark/grpc_testing/test.pb.go b/benchmark/grpc_testing/test.pb.go index d454e578..261ba1cc 100644 --- a/benchmark/grpc_testing/test.pb.go +++ b/benchmark/grpc_testing/test.pb.go @@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } -func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(Empty) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).EmptyCall(ctx, in) @@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf [] return out, nil } -func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(SimpleRequest) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).UnaryCall(ctx, in) diff --git a/examples/route_guide/proto/route_guide.pb.go b/examples/route_guide/proto/route_guide.pb.go index c3d14b2c..5851e023 100644 --- a/examples/route_guide/proto/route_guide.pb.go +++ b/examples/route_guide/proto/route_guide.pb.go @@ -310,9 +310,9 @@ func RegisterRouteGuideServer(s *grpc.Server, srv RouteGuideServer) { s.RegisterService(&_RouteGuide_serviceDesc, srv) } -func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(Point) - if err := proto1.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(RouteGuideServer).GetFeature(ctx, in) diff --git a/interop/grpc_testing/test.pb.go b/interop/grpc_testing/test.pb.go index d454e578..261ba1cc 100755 --- a/interop/grpc_testing/test.pb.go +++ b/interop/grpc_testing/test.pb.go @@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } -func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(Empty) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).EmptyCall(ctx, in) @@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf [] return out, nil } -func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(SimpleRequest) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).UnaryCall(ctx, in) diff --git a/server.go b/server.go index 716ab6ad..79f17f3d 100644 --- a/server.go +++ b/server.go @@ -49,7 +49,7 @@ import ( "google.golang.org/grpc/transport" ) -type methodHandler func(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) +type methodHandler func(srv interface{}, ctx context.Context, codec Codec, buf []byte) (interface{}, error) // MethodDesc represents an RPC service's method specification. type MethodDesc struct { @@ -253,7 +253,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. case compressionNone: statusCode := codes.OK statusDesc := "" - reply, appErr := md.Handler(srv.server, stream.Context(), req) + reply, appErr := md.Handler(srv.server, stream.Context(), s.opts.codec, req) if appErr != nil { if err, ok := appErr.(rpcError); ok { statusCode = err.code diff --git a/test/grpc_testing/test.pb.go b/test/grpc_testing/test.pb.go index d454e578..261ba1cc 100644 --- a/test/grpc_testing/test.pb.go +++ b/test/grpc_testing/test.pb.go @@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } -func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(Empty) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).EmptyCall(ctx, in) @@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf [] return out, nil } -func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) { +func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { in := new(SimpleRequest) - if err := proto.Unmarshal(buf, in); err != nil { + if err := codec.Unmarshal(buf, in); err != nil { return nil, err } out, err := srv.(TestServiceServer).UnaryCall(ctx, in)