blob: 209cbea7d66170098a4c743f6e8746595e59f60f [file] [log] [blame]
Jonathan Hartf86817b2018-08-17 10:35:54 -07001// +build go1.7
2
3package mux
4
5import (
6 "context"
7 "net/http"
8)
9
10func contextGet(r *http.Request, key interface{}) interface{} {
11 return r.Context().Value(key)
12}
13
14func 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
22func contextClear(r *http.Request) {
23 return
24}