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

Method handle

test/end2end_test.go:2085–2101  ·  view source on GitHub ↗
(ctx context.Context, info *tap.Info)

Source from the content-addressed store, hash-verified

2083}
2084
2085func (t *myTap) handle(ctx context.Context, info *tap.Info) (context.Context, error) {
2086 if info != nil {
2087 switch info.FullMethodName {
2088 case "/grpc.testing.TestService/EmptyCall":
2089 t.cnt.Add(1)
2090
2091 if vals := info.Header.Get("return-error"); len(vals) > 0 && vals[0] == "true" {
2092 return nil, status.Errorf(codes.Unknown, "tap error")
2093 }
2094 case "/grpc.testing.TestService/UnaryCall":
2095 return nil, fmt.Errorf("tap error")
2096 case "/grpc.testing.TestService/FullDuplexCall":
2097 return nil, status.Errorf(codes.FailedPrecondition, "test custom error")
2098 }
2099 }
2100 return ctx, nil
2101}
2102
2103func testTap(t *testing.T, e env) {
2104 te := newTest(t, e)

Callers

nothing calls this directly

Calls 3

AddMethod · 0.65
GetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected