MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / WithForwardedRequestID

Function WithForwardedRequestID

pkg/rpcmetadata/request.go:52–68  ·  view source on GitHub ↗

WithForwardedRequestID forwards the incoming request ID to outgoing RPCs.

(ctx context.Context)

Source from the content-addressed store, hash-verified

50
51// WithForwardedRequestID forwards the incoming request ID to outgoing RPCs.
52func WithForwardedRequestID(ctx context.Context) context.Context {
53 inMD, ok := metadata.FromIncomingContext(ctx)
54 if !ok {
55 return ctx
56 }
57 outMD, _ := metadata.FromOutgoingContext(ctx)
58 requestID := inMD.Get(requestIDKey)
59 if len(requestID) == 0 {
60 return ctx
61 }
62 return metadata.NewOutgoingContext(ctx, metadata.Join(
63 outMD,
64 metadata.MD{
65 requestIDKey: requestID,
66 },
67 ))
68}

Callers 6

AuthInfoMethod · 0.92
ApplicationRightsMethod · 0.92
ClientRightsMethod · 0.92
GatewayRightsMethod · 0.92
OrganizationRightsMethod · 0.92
UserRightsMethod · 0.92

Calls 2

GetMethod · 0.65
JoinMethod · 0.65

Tested by

no test coverage detected