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

Function Set

context.go:16–24  ·  view source on GitHub ↗

Set stores a value for a given key in a given request.

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

Source from the content-addressed store, hash-verified

14
15// Set stores a value for a given key in a given request.
16func Set(r *http.Request, key, val interface{}) {
17 mutex.Lock()
18 if data[r] == nil {
19 data[r] = make(map[interface{}]interface{})
20 datat[r] = time.Now().Unix()
21 }
22 data[r][key] = val
23 mutex.Unlock()
24}
25
26// Get returns a value stored for a given key in a given request.
27func Get(r *http.Request, key interface{}) interface{} {

Callers 2

TestContextFunction · 0.85
parallelWriterFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestContextFunction · 0.68
parallelWriterFunction · 0.68