summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/rewrite
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-29 13:12:52 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-29 13:12:52 -0700
commit95d944613bffce1cee3783568ae229e116168ba4 (patch)
tree8ccfe59b7852fbc1e937d62898cec52f92ee2c44 /modules/caddyhttp/rewrite
parent2b33d9a5e5d1bd12d27bea2cfe8341fd1e5703b2 (diff)
Export Replacer and use concrete type instead of interface
The interface was only making things difficult; a concrete pointer is probably best.
Diffstat (limited to 'modules/caddyhttp/rewrite')
-rw-r--r--modules/caddyhttp/rewrite/rewrite.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/caddyhttp/rewrite/rewrite.go b/modules/caddyhttp/rewrite/rewrite.go
index 03c54b1..b875adb 100644
--- a/modules/caddyhttp/rewrite/rewrite.go
+++ b/modules/caddyhttp/rewrite/rewrite.go
@@ -91,7 +91,7 @@ func (rewr Rewrite) Validate() error {
}
func (rewr Rewrite) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
- repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
+ repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
logger := rewr.logger.With(
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: r}),
@@ -124,7 +124,7 @@ func (rewr Rewrite) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddy
// rewrite performs the rewrites on r using repl, which
// should have been obtained from r, but is passed in for
// efficiency. It returns true if any changes were made to r.
-func (rewr Rewrite) rewrite(r *http.Request, repl caddy.Replacer, logger *zap.Logger) bool {
+func (rewr Rewrite) rewrite(r *http.Request, repl *caddy.Replacer, logger *zap.Logger) bool {
oldMethod := r.Method
oldURI := r.RequestURI
@@ -209,7 +209,7 @@ type replacer struct {
}
// do performs the replacement on r and returns true if any changes were made.
-func (rep replacer) do(r *http.Request, repl caddy.Replacer) bool {
+func (rep replacer) do(r *http.Request, repl *caddy.Replacer) bool {
if rep.Find == "" || rep.Replace == "" {
return false
}