summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/rewrite
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-05-06 10:50:26 -0400
committerGitHub <noreply@github.com>2022-05-06 10:50:26 -0400
commitf6900fcf530e80c921dac8e4f09996cffce7f436 (patch)
tree6914d9a1038ff230f9047cae8d219838b6636d81 /modules/caddyhttp/rewrite
parentec86a2f7a3905c888b8c953255a98a50be70d5db (diff)
reverseproxy: Support performing pre-check requests (#4739)
Diffstat (limited to 'modules/caddyhttp/rewrite')
-rw-r--r--modules/caddyhttp/rewrite/rewrite.go4
-rw-r--r--modules/caddyhttp/rewrite/rewrite_test.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/caddyhttp/rewrite/rewrite.go b/modules/caddyhttp/rewrite/rewrite.go
index cd340e3..690e752 100644
--- a/modules/caddyhttp/rewrite/rewrite.go
+++ b/modules/caddyhttp/rewrite/rewrite.go
@@ -106,7 +106,7 @@ func (rewr Rewrite) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddy
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: r}),
)
- changed := rewr.rewrite(r, repl, logger)
+ changed := rewr.Rewrite(r, repl)
if changed {
logger.Debug("rewrote request",
@@ -121,7 +121,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) bool {
oldMethod := r.Method
oldURI := r.RequestURI
diff --git a/modules/caddyhttp/rewrite/rewrite_test.go b/modules/caddyhttp/rewrite/rewrite_test.go
index 38d96fe..3e2e13d 100644
--- a/modules/caddyhttp/rewrite/rewrite_test.go
+++ b/modules/caddyhttp/rewrite/rewrite_test.go
@@ -292,7 +292,7 @@ func TestRewrite(t *testing.T) {
rep.re = re
}
- changed := tc.rule.rewrite(tc.input, repl, nil)
+ changed := tc.rule.Rewrite(tc.input, repl)
if expected, actual := !reqEqual(originalInput, tc.input), changed; expected != actual {
t.Errorf("Test %d: Expected changed=%t but was %t", i, expected, actual)