Commit f9b8617f authored by astaxie's avatar astaxie

context: fix multipart/form-data

parent 6c6e4ecf
......@@ -274,19 +274,13 @@ func (input *BeegoInput) SetData(key, val interface{}) {
// parseForm or parseMultiForm based on Content-type
func (input *BeegoInput) ParseFormOrMulitForm(maxMemory int64) error {
// Parse the body depending on the content type.
switch input.Header("Content-Type") {
case "application/x-www-form-urlencoded":
// Typical form.
if err := input.Request.ParseForm(); err != nil {
return errors.New("Error parsing request body:" + err.Error())
}
case "multipart/form-data":
if strings.Contains(input.Header("Content-Type"), "multipart/form-data") {
if err := input.Request.ParseMultipartForm(maxMemory); err != nil {
return errors.New("Error parsing request body:" + err.Error())
}
} else if err := input.Request.ParseForm(); err != nil {
return errors.New("Error parsing request body:" + err.Error())
}
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment