github.com/topsteplocal/gophish@v0.6.0/context/context.go (about) 1 // +build go1.7 2 3 package context 4 5 import ( 6 "net/http" 7 8 "context" 9 ) 10 11 func Get(r *http.Request, key interface{}) interface{} { 12 return r.Context().Value(key) 13 } 14 15 func Set(r *http.Request, key, val interface{}) *http.Request { 16 if val == nil { 17 return r 18 } 19 20 return r.WithContext(context.WithValue(r.Context(), key, val)) 21 } 22 23 func Clear(r *http.Request) { 24 return 25 }