MCPcopy
hub / github.com/grpc/grpc-go / serverNewPayload

Function serverNewPayload

interop/test_utils.go:711–725  ·  view source on GitHub ↗
(t testpb.PayloadType, size int32)

Source from the content-addressed store, hash-verified

709}
710
711func serverNewPayload(t testpb.PayloadType, size int32) (*testpb.Payload, error) {
712 if size < 0 {
713 return nil, fmt.Errorf("requested a response with invalid length %d", size)
714 }
715 body := make([]byte, size)
716 switch t {
717 case testpb.PayloadType_COMPRESSABLE:
718 default:
719 return nil, fmt.Errorf("unsupported payload type: %d", t)
720 }
721 return &testpb.Payload{
722 Type: t,
723 Body: body,
724 }, nil
725}
726
727func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
728 st := in.GetResponseStatus()

Callers 4

UnaryCallMethod · 0.85
StreamingOutputCallMethod · 0.85
FullDuplexCallMethod · 0.85
HalfDuplexCallMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected