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

Function newPayload

test/end2end_test.go:170–184  ·  view source on GitHub ↗
(t testpb.PayloadType, size int32)

Source from the content-addressed store, hash-verified

168}
169
170func newPayload(t testpb.PayloadType, size int32) (*testpb.Payload, error) {
171 if size < 0 {
172 return nil, fmt.Errorf("requested a response with invalid length %d", size)
173 }
174 body := make([]byte, size)
175 switch t {
176 case testpb.PayloadType_COMPRESSABLE:
177 default:
178 return nil, fmt.Errorf("unsupported payload type: %d", t)
179 }
180 return &testpb.Payload{
181 Type: t,
182 Body: body,
183 }, nil
184}
185
186func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
187 md, ok := metadata.FromIncomingContext(ctx)

Callers 15

TestRetryStreamingMethod · 0.85
testCompressOKFunction · 0.85
testIdentityEncodingFunction · 0.85
testCompressorRegisterFunction · 0.85
TestGzipBadChecksumMethod · 0.85
UnaryCallMethod · 0.85
StreamingOutputCallMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected