mirror of
https://github.com/gophish/gophish
synced 2024-11-15 00:37:14 +00:00
26 lines
364 B
Go
26 lines
364 B
Go
|
// +build go1.7
|
||
|
|
||
|
package context
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
func Get(r *http.Request, key interface{}) interface{} {
|
||
|
return r.Context().Value(key)
|
||
|
}
|
||
|
|
||
|
func Set(r *http.Request, key, val interface{}) *http.Request {
|
||
|
if val == nil {
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
return r.WithContext(context.WithValue(r.Context(), key, val))
|
||
|
}
|
||
|
|
||
|
func Clear(r *http.Request) {
|
||
|
return
|
||
|
}
|