MCPcopy Create free account
hub / github.com/prometheus/common / WithParam

Function WithParam

route/route.go:35–37  ·  view source on GitHub ↗

WithParam returns a new context with param p set to v.

(ctx context.Context, p, v string)

Source from the content-addressed store, hash-verified

33
34// WithParam returns a new context with param p set to v.
35func WithParam(ctx context.Context, p, v string) context.Context {
36 return context.WithValue(ctx, param(p), v)
37}
38
39// Router wraps httprouter.Router and adds support for prefixed sub-routers,
40// per-request context injections and instrumentation.

Callers 1

TestContextWithValueFunction · 0.85

Calls 1

paramTypeAlias · 0.85

Tested by 1

TestContextWithValueFunction · 0.68