1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-14 11:10:38 +00:00

fix application/x-www-form-urlencoded request body oversize

This commit is contained in:
Anker Jam
2020-10-18 23:38:08 +08:00
parent c510926cb8
commit cbb3de741d
2 changed files with 2 additions and 2 deletions

View File

@ -423,8 +423,8 @@ func (input *BeegoInput) SetData(key, val interface{}) {
// ParseFormOrMultiForm parseForm or parseMultiForm based on Content-type
func (input *BeegoInput) ParseFormOrMultiForm(maxMemory int64) error {
// Parse the body depending on the content type.
input.Context.Request.Body = http.MaxBytesReader(input.Context.ResponseWriter, input.Context.Request.Body, maxMemory)
if strings.Contains(input.Header("Content-Type"), "multipart/form-data") {
input.Context.Request.Body = http.MaxBytesReader(input.Context.ResponseWriter, input.Context.Request.Body, maxMemory)
if err := input.Context.Request.ParseMultipartForm(maxMemory); err != nil {
return errors.New("Error parsing request body:" + err.Error())
}