MCPcopy Create free account
hub / github.com/gorilla/context / Get

Function Get

context.go:27–36  ·  view source on GitHub ↗

Get returns a value stored for a given key in a given request.

(r *http.Request, key interface{})

Source from the content-addressed store, hash-verified

25
26// Get returns a value stored for a given key in a given request.
27func Get(r *http.Request, key interface{}) interface{} {
28 mutex.RLock()
29 if ctx := data[r]; ctx != nil {
30 value := ctx[key]
31 mutex.RUnlock()
32 return value
33 }
34 mutex.RUnlock()
35 return nil
36}
37
38// GetOk returns stored value and presence state like multi-value return of map access.
39func GetOk(r *http.Request, key interface{}) (interface{}, bool) {

Callers 2

TestContextFunction · 0.85
parallelReaderFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestContextFunction · 0.68
parallelReaderFunction · 0.68