NOTE(stevvooe): We can stub this file out if we don't want a grpc dependency here.
(ctx context.Context, namespace string)
| 30 | // NOTE(stevvooe): We can stub this file out if we don't want a grpc dependency here. |
| 31 | |
| 32 | func withGRPCNamespaceHeader(ctx context.Context, namespace string) context.Context { |
| 33 | // also store on the grpc headers so it gets picked up by any clients that |
| 34 | // are using this. |
| 35 | nsheader := metadata.Pairs(GRPCHeader, namespace) |
| 36 | md, ok := metadata.FromOutgoingContext(ctx) // merge with outgoing context. |
| 37 | if !ok { |
| 38 | md = nsheader |
| 39 | } else { |
| 40 | // order ensures the latest is first in this list. |
| 41 | md = metadata.Join(nsheader, md) |
| 42 | } |
| 43 | |
| 44 | return metadata.NewOutgoingContext(ctx, md) |
| 45 | } |
| 46 | |
| 47 | func fromGRPCHeader(ctx context.Context) (string, bool) { |
| 48 | // try to extract for use in grpc servers. |
no outgoing calls
no test coverage detected
searching dependent graphs…