mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
core: Add ReplaceFunc method to Replacer to allow dynamic replacements
This commit is contained in:
parent
080a62d5c5
commit
fe516575db
2 changed files with 38 additions and 13 deletions
|
@ -133,7 +133,7 @@ func TestReplacerSet(t *testing.T) {
|
|||
|
||||
func TestReplacerReplaceKnown(t *testing.T) {
|
||||
rep := replacer{
|
||||
providers: []ReplacementFunc{
|
||||
providers: []ReplacerFunc{
|
||||
// split our possible vars to two functions (to test if both functions are called)
|
||||
func(key string) (val string, ok bool) {
|
||||
switch key {
|
||||
|
@ -239,7 +239,7 @@ func TestReplacerDelete(t *testing.T) {
|
|||
func TestReplacerMap(t *testing.T) {
|
||||
rep := testReplacer()
|
||||
|
||||
for i, tc := range []ReplacementFunc{
|
||||
for i, tc := range []ReplacerFunc{
|
||||
func(key string) (val string, ok bool) {
|
||||
return "", false
|
||||
},
|
||||
|
@ -317,7 +317,7 @@ func TestReplacerNew(t *testing.T) {
|
|||
|
||||
func testReplacer() replacer {
|
||||
return replacer{
|
||||
providers: make([]ReplacementFunc, 0),
|
||||
providers: make([]ReplacerFunc, 0),
|
||||
static: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue