From 65195a726d9ceff4bbf870b7baa7eff20cf35381 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 20 May 2019 23:48:43 -0600 Subject: Implement rewrite middleware; fix middleware stack bugs --- modules/caddyhttp/matchers_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/caddyhttp/matchers_test.go') diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go index c279bad..c4c7845 100644 --- a/modules/caddyhttp/matchers_test.go +++ b/modules/caddyhttp/matchers_test.go @@ -227,9 +227,10 @@ func TestPathREMatcher(t *testing.T) { // set up the fake request and its Replacer req := &http.Request{URL: &url.URL{Path: tc.input}} - repl := newReplacer(req, httptest.NewRecorder()) + repl := caddy2.NewReplacer() ctx := context.WithValue(req.Context(), caddy2.ReplacerCtxKey, repl) req = req.WithContext(ctx) + addHTTPVarsToReplacer(repl, req, httptest.NewRecorder()) actual := tc.match.Match(req) if actual != tc.expect { @@ -344,9 +345,10 @@ func TestHeaderREMatcher(t *testing.T) { // set up the fake request and its Replacer req := &http.Request{Header: tc.input, URL: new(url.URL)} - repl := newReplacer(req, httptest.NewRecorder()) + repl := caddy2.NewReplacer() ctx := context.WithValue(req.Context(), caddy2.ReplacerCtxKey, repl) req = req.WithContext(ctx) + addHTTPVarsToReplacer(repl, req, httptest.NewRecorder()) actual := tc.match.Match(req) if actual != tc.expect { -- cgit v1.2.3