| Jonathan Hart | f86817b | 2018-08-17 10:35:54 -0700 | [diff] [blame^] | 1 | // +build go1.7 |
| 2 | |||||
| 3 | package mux | ||||
| 4 | |||||
| 5 | import ( | ||||
| 6 | "context" | ||||
| 7 | "net/http" | ||||
| 8 | ) | ||||
| 9 | |||||
| 10 | func contextGet(r *http.Request, key interface{}) interface{} { | ||||
| 11 | return r.Context().Value(key) | ||||
| 12 | } | ||||
| 13 | |||||
| 14 | func contextSet(r *http.Request, key, val interface{}) *http.Request { | ||||
| 15 | if val == nil { | ||||
| 16 | return r | ||||
| 17 | } | ||||
| 18 | |||||
| 19 | return r.WithContext(context.WithValue(r.Context(), key, val)) | ||||
| 20 | } | ||||
| 21 | |||||
| 22 | func contextClear(r *http.Request) { | ||||
| 23 | return | ||||
| 24 | } | ||||