blob: 665940a2682ec86e06822ab1fba0db9a7eb77a61 [file] [log] [blame]
Zdravko Bozakov958d81c2019-12-13 22:09:48 +01001package mux
2
3import (
4 "context"
5 "net/http"
6)
7
8func contextGet(r *http.Request, key interface{}) interface{} {
9 return r.Context().Value(key)
10}
11
12func contextSet(r *http.Request, key, val interface{}) *http.Request {
13 if val == nil {
14 return r
15 }
16
17 return r.WithContext(context.WithValue(r.Context(), key, val))
18}