diff options
author | 2017-11-19 21:10:04 -0800 | |
---|---|---|
committer | 2017-11-19 22:01:46 -0800 | |
commit | 8ffb773f43c8dc54801ca1d111854e7e881c93c9 (patch) | |
tree | 38133a2fc612597a75fed1d13e5b4042f58a2b7e /vendor/github.com/gorilla/mux/context_native.go |
First commit
Diffstat (limited to 'vendor/github.com/gorilla/mux/context_native.go')
-rw-r--r-- | vendor/github.com/gorilla/mux/context_native.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/mux/context_native.go b/vendor/github.com/gorilla/mux/context_native.go new file mode 100644 index 0000000..209cbea --- /dev/null +++ b/vendor/github.com/gorilla/mux/context_native.go @@ -0,0 +1,24 @@ +// +build go1.7 + +package mux + +import ( + "context" + "net/http" +) + +func contextGet(r *http.Request, key interface{}) interface{} { + return r.Context().Value(key) +} + +func contextSet(r *http.Request, key, val interface{}) *http.Request { + if val == nil { + return r + } + + return r.WithContext(context.WithValue(r.Context(), key, val)) +} + +func contextClear(r *http.Request) { + return +} |