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

Function authHandle

test/creds_test.go:309–324  ·  view source on GitHub ↗
(ctx context.Context, _ *tap.Info)

Source from the content-addressed store, hash-verified

307}
308
309func authHandle(ctx context.Context, _ *tap.Info) (context.Context, error) {
310 md, ok := metadata.FromIncomingContext(ctx)
311 if !ok {
312 return ctx, fmt.Errorf("didn't find metadata in context")
313 }
314 for k, vwant := range authdata {
315 vgot, ok := md[k]
316 if !ok {
317 return ctx, fmt.Errorf("didn't find authdata key %v in context", k)
318 }
319 if vgot[0] != vwant {
320 return ctx, fmt.Errorf("for key %v, got value %v, want %v", k, vgot, vwant)
321 }
322 }
323 return ctx, nil
324}
325
326func (s) TestPerRPCCredentialsViaDialOptions(t *testing.T) {
327 for _, e := range listTestEnv() {

Callers

nothing calls this directly

Calls 2

FromIncomingContextFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected