1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 23:50:49 +00:00

config index out of range bug fixed

This commit is contained in:
JessonChan 2016-03-21 09:32:41 +08:00
parent 4caf044be2
commit 959b9a5a58
2 changed files with 2 additions and 1 deletions

View File

@ -353,7 +353,7 @@ func (b *beegoAppConfig) String(key string) string {
}
func (b *beegoAppConfig) Strings(key string) []string {
if v := b.innerConfig.Strings(BConfig.RunMode + "::" + key); v[0] != "" {
if v := b.innerConfig.Strings(BConfig.RunMode + "::" + key); len(v) > 0 {
return v
}
return b.innerConfig.Strings(key)

View File

@ -49,6 +49,7 @@ func InitGzip(cf config.Configer) {
}
methods := cf.DefaultStrings("includedMethods", []string{"GET"})
getMethodOnly = (len(methods) == 0) || (len(methods) == 1 && strings.ToUpper(methods[0]) == "GET")
includedMethods = make(map[string]bool, len(methods))
for _, v := range methods {
includedMethods[strings.ToUpper(v)] = true
}