MCPcopy
hub / github.com/caddyserver/caddy / GetVar

Function GetVar

modules/caddyhttp/vars.go:433–439  ·  modules/caddyhttp/vars.go::GetVar

GetVar gets a value out of the context's variable table by key. If the key does not exist, the return value will be nil.

(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

431// GetVar gets a value out of the context's variable table by key.
432// If the key does not exist, the return value will be nil.
433func GetVar(ctx context.Context, key string) any {
434 varMap, ok := ctx.Value(VarsCtxKey).(map[string]any)
435 if !ok {
436 return nil
437 }
438 return varMap[key]
439}
440
441// SetVar sets a value in the context's variable table with
442// the given key. It overwrites any previous value with the

Callers 15

ClientIPMethod · 0.92
WriteHeaderMethod · 0.92
handleUpgradeResponseMethod · 0.92
NewTransportMethod · 0.92
SelectMethod · 0.92
SelectMethod · 0.92
GetDialInfoFunction · 0.92
prepareRequestMethod · 0.92
addForwardedHeadersMethod · 0.92
directRequestMethod · 0.92
logRequestMethod · 0.85
MatchWithErrorMethod · 0.85

Calls 1

ValueMethod · 0.45

Tested by

no test coverage detected