summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--caddytest/integration/map_test.go4
-rw-r--r--modules/caddyhttp/map/map.go1
2 files changed, 3 insertions, 2 deletions
diff --git a/caddytest/integration/map_test.go b/caddytest/integration/map_test.go
index aa535ec..7cd769e 100644
--- a/caddytest/integration/map_test.go
+++ b/caddytest/integration/map_test.go
@@ -19,7 +19,7 @@ func TestMap(t *testing.T) {
map {http.request.method} {dest-1} {dest-2} {
default unknown1 unknown2
- ~G.T get-called
+ ~G(.)(.) G${1}${2}-called
POST post-called foobar
}
@@ -30,7 +30,7 @@ func TestMap(t *testing.T) {
`, "caddyfile")
// act and assert
- tester.AssertGetResponse("http://localhost:9080/version", 200, "hello from localhost get-called unknown2")
+ tester.AssertGetResponse("http://localhost:9080/version", 200, "hello from localhost GET-called unknown2")
tester.AssertPostResponseBody("http://localhost:9080/version", []string{}, bytes.NewBuffer([]byte{}), 200, "hello from localhost post-called foobar")
}
diff --git a/modules/caddyhttp/map/map.go b/modules/caddyhttp/map/map.go
index e193f20..a0e0768 100644
--- a/modules/caddyhttp/map/map.go
+++ b/modules/caddyhttp/map/map.go
@@ -136,6 +136,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhtt
if output := m.Outputs[destIdx]; output == nil {
continue
} else {
+ output = m.re.ReplaceAllString(input, m.Outputs[destIdx].(string))
return output, true
}
}