Added Const for use of CtxKeys (#1511)

* Added Const for CtxKeys

* Move CtxKey Const declarations

* Fixed tests

* fix test
This commit is contained in:
Toby Allen
2017-03-13 15:22:46 +00:00
committed by Matt Holt
parent 96bfb9f347
commit d5cc10f7aa
14 changed files with 39 additions and 43 deletions
+13
View File
@@ -197,3 +197,16 @@ var EmptyNext = HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, e
func SameNext(next1, next2 Handler) bool {
return fmt.Sprintf("%v", next1) == fmt.Sprintf("%v", next2)
}
// Context key constants
const (
// URIxRewriteCtxKey is a context key used to store original unrewritten
// URI in context.WithValue
URIxRewriteCtxKey caddy.CtxKey = "caddy_rewrite_original_uri"
// RemoteUserCtxKey is a context key used to store remote user for request
RemoteUserCtxKey caddy.CtxKey = "remote_user"
// MitmCtxKey stores Mitm result
MitmCtxKey caddy.CtxKey = "mitm"
)