summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/replacer_test.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-10-14 12:09:43 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-10-14 12:09:43 -0600
commitacf7dea68fe6ace110221faa26c2503a1ea432ce (patch)
tree7be6cea0e3e62a2e42a8b141517164e8dc4f3b9c /modules/caddyhttp/replacer_test.go
parentbc738991b6234bf334855e1396919e79ef9791b8 (diff)
caddyhttp: host labels placeholders endianness from right->left
https://caddy.community/t/labeln-placeholder-endian-issue/5366 (I thought we had this before but it must have gotten lost somewhere)
Diffstat (limited to 'modules/caddyhttp/replacer_test.go')
-rw-r--r--modules/caddyhttp/replacer_test.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/caddyhttp/replacer_test.go b/modules/caddyhttp/replacer_test.go
index d10c74f..b355c7f 100644
--- a/modules/caddyhttp/replacer_test.go
+++ b/modules/caddyhttp/replacer_test.go
@@ -34,8 +34,8 @@ func TestHTTPVarReplacement(t *testing.T) {
addHTTPVarsToReplacer(repl, req, res)
for i, tc := range []struct {
- input string
- expect string
+ input string
+ expect string
}{
{
input: "{http.request.scheme}",
@@ -61,6 +61,14 @@ func TestHTTPVarReplacement(t *testing.T) {
input: "{http.request.remote.port}",
expect: "1234",
},
+ {
+ input: "{http.request.host.labels.0}",
+ expect: "com",
+ },
+ {
+ input: "{http.request.host.labels.1}",
+ expect: "example",
+ },
} {
actual := repl.ReplaceAll(tc.input, "<empty>")
if actual != tc.expect {