caddyhttp: Accept placeholders in vars matcher key

Until now, the vars matcher has unintentionally lacked parity with the
map directive: the destination placeholders of the map directive would
be expressed as placeholders, i.e. {foo}. But the vars matcher would
not use { }: vars foo value

This looked weird, and was confusing, since it implied that the key
could be dynamic, which doesn't seem helpful here.

I think this is a proper bug fix, since we're not used to accessing
placeholders literally without { } in the Caddyfile.
This commit is contained in:
Matthew Holt 2022-09-01 16:49:18 -06:00
parent 1edc1a45e3
commit 7c35bfa57c
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
2 changed files with 24 additions and 19 deletions

View file

@ -238,6 +238,8 @@ func toString(val any) string {
return v
case fmt.Stringer:
return v.String()
case error:
return v.Error()
case byte:
return string(v)
case []byte: