(t testpb.PayloadType, size int32)
| 168 | } |
| 169 | |
| 170 | func 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 | |
| 186 | func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 187 | md, ok := metadata.FromIncomingContext(ctx) |
no test coverage detected