Fixes multipart integration

This commit is contained in:
Manu Mtz-Almeida
2015-05-26 16:31:05 +02:00
parent 500d745123
commit af8e099dfd
2 changed files with 7 additions and 4 deletions

View File

@ -232,11 +232,13 @@ func (c *Context) query(key string) (string, bool) {
func (c *Context) postForm(key string) (string, bool) {
req := c.Request
req.ParseMultipartForm(32 << 20) // 32 MB
if values, ok := req.PostForm[key]; ok && len(values) > 0 {
if values := req.PostForm[key]; len(values) > 0 {
return values[0], true
}
if values, ok := req.MultipartForm.Value[key]; ok && len(values) > 0 {
return values[0], true
if req.MultipartForm != nil && req.MultipartForm.File != nil {
if values := req.MultipartForm.Value[key]; len(values) > 0 {
return values[0], true
}
}
return "", false
}