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

Method EmptyCall

test/end2end_test.go:154–168  ·  view source on GitHub ↗
(ctx context.Context, _ *testpb.Empty)

Source from the content-addressed store, hash-verified

152}
153
154func (s *testServer) EmptyCall(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) {
155 if md, ok := metadata.FromIncomingContext(ctx); ok {
156 // For testing purpose, returns an error if user-agent is failAppUA.
157 // To test that client gets the correct error.
158 if ua, ok := md["user-agent"]; !ok || strings.HasPrefix(ua[0], failAppUA) {
159 return nil, detailedError
160 }
161 var str []string
162 for _, entry := range md["user-agent"] {
163 str = append(str, "ua", entry)
164 }
165 grpc.SendHeader(ctx, metadata.Pairs(str...))
166 }
167 return new(testpb.Empty), nil
168}
169
170func newPayload(t testpb.PayloadType, size int32) (*testpb.Payload, error) {
171 if size < 0 {

Callers

nothing calls this directly

Calls 3

FromIncomingContextFunction · 0.92
SendHeaderFunction · 0.92
PairsFunction · 0.92

Tested by

no test coverage detected