Drop support for Go < 1.7: remove gorilla/context (#391)
* Drop support for Go < 1.7: remove gorilla/context * Remove Go < 1.7 from Travis CI config * Remove unneeded _native from context files
This commit is contained in:
committed by
Matt Silverlock
parent
962c5bed07
commit
8771f97498
22
context.go
Normal file
22
context.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user