summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2024-03-21 13:21:53 -0400
committerGitHub <[email protected]>2024-03-21 11:21:53 -0600
commitd13258423dda01fa48943b203ba8074428c776e4 (patch)
tree38210d0502e3a05fcd230c12241a361eff3bc4e4
parent32f7dd44aea270fa6c50bbf80acf5b831fc6ffcd (diff)
downloadcaddy-d13258423dda01fa48943b203ba8074428c776e4.tar.gz
caddy-d13258423dda01fa48943b203ba8074428c776e4.zip
vars: Make nil values act as empty string instead of `"<nil>"` (#6174)
-rw-r--r--modules/caddyhttp/vars.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/vars.go b/modules/caddyhttp/vars.go
index f5afe264a..9908ada9b 100644
--- a/modules/caddyhttp/vars.go
+++ b/modules/caddyhttp/vars.go
@@ -190,6 +190,8 @@ func (m VarsMatcher) Match(r *http.Request) bool {
varStr = vv.String()
case error:
varStr = vv.Error()
+ case nil:
+ varStr = ""
default:
varStr = fmt.Sprintf("%v", vv)
}
@@ -281,6 +283,8 @@ func (m MatchVarsRE) Match(r *http.Request) bool {
varStr = vv.String()
case error:
varStr = vv.Error()
+ case nil:
+ varStr = ""
default:
varStr = fmt.Sprintf("%v", vv)
}