diff --git a/customHeaders.go b/customHeaders.go index 7e9a2e3..d10b540 100644 --- a/customHeaders.go +++ b/customHeaders.go @@ -27,13 +27,13 @@ type HeaderConfig struct { } func (config *HeaderConfig) Init() { - if config.UsesRegex() { + if len(config.Regex) > 0 { config.CompiledRegex = regexp.MustCompile(config.Regex) } } func (config *HeaderConfig) UsesRegex() bool { - return len(config.Regex) > 0 + return config.CompiledRegex != nil } // HeaderDefiniton is a key value pair of a specified header rule