summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/map/map_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/map/map_test.go')
-rw-r--r--modules/caddyhttp/map/map_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/caddyhttp/map/map_test.go b/modules/caddyhttp/map/map_test.go
index fe233bf..3ff5e71 100644
--- a/modules/caddyhttp/map/map_test.go
+++ b/modules/caddyhttp/map/map_test.go
@@ -98,6 +98,28 @@ func TestHandler(t *testing.T) {
"output": "testing",
},
},
+ {
+ reqURI: "/foo",
+ handler: Handler{
+ Source: "{http.request.uri.path}",
+ Destinations: []string{"{output}"},
+ Defaults: []string{"default"},
+ },
+ expect: map[string]any{
+ "output": "default",
+ },
+ },
+ {
+ reqURI: "/foo",
+ handler: Handler{
+ Source: "{http.request.uri.path}",
+ Destinations: []string{"{output}"},
+ Defaults: []string{"{testvar}"},
+ },
+ expect: map[string]any{
+ "output": "testing",
+ },
+ },
} {
if err := tc.handler.Provision(caddy.Context{}); err != nil {
t.Fatalf("Test %d: Provisioning handler: %v", i, err)