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

Method GetRequestMetadata

pkg/rpcmetadata/request.go:26–35  ·  view source on GitHub ↗

GetRequestMetadata returns the request metadata with per-rpc credentials

(ctx context.Context, uri ...string)

Source from the content-addressed store, hash-verified

24
25// GetRequestMetadata returns the request metadata with per-rpc credentials
26func (m MD) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
27 md := make(map[string]string)
28 if m.ID != "" {
29 md["id"] = m.ID
30 }
31 if m.AuthType != "" && m.AuthValue != "" {
32 md["authorization"] = m.AuthType + " " + m.AuthValue
33 }
34 return md, nil
35}
36
37var errUnauthenticated = errors.DefineUnauthenticated("unauthenticated", "the context is not authenticated")
38

Callers 1

TestRequestMetadataFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestRequestMetadataFunction · 0.76