From d13258423dda01fa48943b203ba8074428c776e4 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 21 Mar 2024 13:21:53 -0400 Subject: [PATCH] vars: Make nil values act as empty string instead of `""` (#6174) --- modules/caddyhttp/vars.go | 4 ++++ 1 file changed, 4 insertions(+) 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) }