1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 08:30:54 +00:00

Fix concurrent form parsing and getting

This commit is contained in:
playHing 2020-07-11 02:06:09 +08:00
parent b50fb44950
commit 55e6298f29

View File

@ -332,9 +332,13 @@ func (input *BeegoInput) Query(key string) string {
if val := input.Param(key); val != "" { if val := input.Param(key); val != "" {
return val return val
} }
if input.Context.Request.Form == nil {
input.dataLock.Lock()
defer input.dataLock.Unlock()
if input.Context.Request.Form == nil { if input.Context.Request.Form == nil {
input.Context.Request.ParseForm() input.Context.Request.ParseForm()
} }
}
return input.Context.Request.Form.Get(key) return input.Context.Request.Form.Get(key)
} }