f9b8617f by astaxie

context: fix multipart/form-data

1 parent 6c6e4ecf
...@@ -274,19 +274,13 @@ func (input *BeegoInput) SetData(key, val interface{}) { ...@@ -274,19 +274,13 @@ func (input *BeegoInput) SetData(key, val interface{}) {
274 // parseForm or parseMultiForm based on Content-type 274 // parseForm or parseMultiForm based on Content-type
275 func (input *BeegoInput) ParseFormOrMulitForm(maxMemory int64) error { 275 func (input *BeegoInput) ParseFormOrMulitForm(maxMemory int64) error {
276 // Parse the body depending on the content type. 276 // Parse the body depending on the content type.
277 switch input.Header("Content-Type") { 277 if strings.Contains(input.Header("Content-Type"), "multipart/form-data") {
278 case "application/x-www-form-urlencoded":
279 // Typical form.
280 if err := input.Request.ParseForm(); err != nil {
281 return errors.New("Error parsing request body:" + err.Error())
282 }
283
284 case "multipart/form-data":
285 if err := input.Request.ParseMultipartForm(maxMemory); err != nil { 278 if err := input.Request.ParseMultipartForm(maxMemory); err != nil {
286 return errors.New("Error parsing request body:" + err.Error()) 279 return errors.New("Error parsing request body:" + err.Error())
287 } 280 }
281 } else if err := input.Request.ParseForm(); err != nil {
282 return errors.New("Error parsing request body:" + err.Error())
288 } 283 }
289
290 return nil 284 return nil
291 } 285 }
292 286
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!