0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-30 22:34:15 -05:00

vars: Make nil values act as empty string instead of "<nil>" (#6174)

This commit is contained in:
Francis Lavoie 2024-03-21 13:21:53 -04:00 committed by GitHub
parent 32f7dd44ae
commit d13258423d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -190,6 +190,8 @@ func (m VarsMatcher) Match(r *http.Request) bool {
varStr = vv.String() varStr = vv.String()
case error: case error:
varStr = vv.Error() varStr = vv.Error()
case nil:
varStr = ""
default: default:
varStr = fmt.Sprintf("%v", vv) varStr = fmt.Sprintf("%v", vv)
} }
@ -281,6 +283,8 @@ func (m MatchVarsRE) Match(r *http.Request) bool {
varStr = vv.String() varStr = vv.String()
case error: case error:
varStr = vv.Error() varStr = vv.Error()
case nil:
varStr = ""
default: default:
varStr = fmt.Sprintf("%v", vv) varStr = fmt.Sprintf("%v", vv)
} }