caddyhttp: Add 'map' handler (#3199)

* inital map implementation

* resolve the value during middleware execution

* use regex instead

* pr feedback

* renamed mmap to maphandler

* refactored GetString implementation

* fixed mispelling

* additional feedback
This commit is contained in:
Mark Sargent
2020-06-27 09:12:37 +12:00
committed by GitHub
parent caca55e582
commit 6004d3f779
6 changed files with 328 additions and 0 deletions

View File

@@ -66,6 +66,13 @@ func (r *Replacer) Get(variable string) (interface{}, bool) {
return nil, false
}
// GetString is the same as Get, but coerces the value to a
// string representation.
func (r *Replacer) GetString(variable string) (string, bool) {
s, found := r.Get(variable)
return toString(s), found
}
// Delete removes a variable with a static value
// that was created using Set.
func (r *Replacer) Delete(variable string) {