mirror of
https://github.com/caddyserver/caddy.git
synced 2026-07-02 14:51:10 +00:00
Add tests for case insensitivity of keys and saving contexts
This commit is contained in:
parent
76d9d695be
commit
9077cce126
2 changed files with 56 additions and 3 deletions
|
|
@ -65,7 +65,7 @@ type httpContext struct {
|
|||
|
||||
func (h *httpContext) saveConfig(key string, cfg *SiteConfig) {
|
||||
h.siteConfigs = append(h.siteConfigs, cfg)
|
||||
h.keysToSiteConfigs[strings.ToLower(key)] = cfg
|
||||
h.keysToSiteConfigs[key] = cfg
|
||||
}
|
||||
|
||||
// InspectServerBlocks make sure that everything checks out before
|
||||
|
|
@ -178,8 +178,9 @@ func GetConfig(c *caddy.Controller) *SiteConfig {
|
|||
// we should only get here during tests because directive
|
||||
// actions typically skip the server blocks where we make
|
||||
// the configs
|
||||
ctx.saveConfig(key, &SiteConfig{Root: Root, TLS: new(caddytls.Config)})
|
||||
return GetConfig(c)
|
||||
cfg := &SiteConfig{Root: Root, TLS: new(caddytls.Config)}
|
||||
ctx.saveConfig(key, cfg)
|
||||
return cfg
|
||||
}
|
||||
|
||||
// shortCaddyfileLoader loads a Caddyfile if positional arguments are
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue