MCPcopy Create free account
hub / github.com/zalando/skipper / NewContext

Function NewContext

routing/context.go:14–19  ·  view source on GitHub ↗

NewContext returns a new context with associated routing context. It does nothing and returns ctx if it already has associated routing context.

(ctx context.Context)

Source from the content-addressed store, hash-verified

12// NewContext returns a new context with associated routing context.
13// It does nothing and returns ctx if it already has associated routing context.
14func NewContext(ctx context.Context) context.Context {
15 if _, ok := ctx.Value(routingContextKey).(*sync.Map); ok {
16 return ctx
17 }
18 return context.WithValue(ctx, routingContextKey, &sync.Map{})
19}
20
21// FromContext returns value from the routing context stored in ctx.
22// It returns value associated with the key or stores result of the defaultValue call.

Callers 5

requestWithRFunction · 0.92
ServeHTTPMethod · 0.92
SplitMethod · 0.92
TestContextFunction · 0.85
TestContextDefaultFunction · 0.85

Calls

no outgoing calls

Tested by 3

requestWithRFunction · 0.74
TestContextFunction · 0.68
TestContextDefaultFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…