MCPcopy Create free account
hub / github.com/pace/bricks / prepareClientContext

Function prepareClientContext

grpc/client.go:78–95  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

76}
77
78func prepareClientContext(ctx context.Context) context.Context {
79 if loc, ok := locale.FromCtx(ctx); ok {
80 ctx = metadata.AppendToOutgoingContext(ctx, MetadataKeyLocale, loc.Serialize())
81 }
82 if token, ok := security.GetTokenFromContext(ctx); ok {
83 ctx = metadata.AppendToOutgoingContext(ctx, MetadataKeyBearerToken, token.GetValue())
84 }
85 if reqID := log.RequestIDFromContext(ctx); reqID != "" {
86 ctx = metadata.AppendToOutgoingContext(ctx, MetadataKeyRequestID, reqID)
87 }
88 ctx = EncodeContextWithUTMData(ctx)
89
90 if dep := middleware.ExternalDependencyContextFromContext(ctx); dep != nil {
91 ctx = metadata.AppendToOutgoingContext(ctx, MetadataKeyExternalDependencies, dep.String())
92 }
93
94 return ctx
95}

Callers 1

NewClientFunction · 0.85

Calls 8

FromCtxFunction · 0.92
GetTokenFromContextFunction · 0.92
RequestIDFromContextFunction · 0.92
EncodeContextWithUTMDataFunction · 0.85
SerializeMethod · 0.80
GetValueMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…