File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -264,20 +264,15 @@ func (input *BeegoInput) SetData(key, val interface{}) {
264
264
input .Data [key ] = val
265
265
}
266
266
267
+ // parseForm or parseMultiForm based on Content-type
267
268
func (input * BeegoInput ) ParseFormOrMulitForm (maxMemory int64 ) error {
268
269
// Parse the body depending on the content type.
269
- switch input .Header ("Content-Type" ) {
270
- case "application/x-www-form-urlencoded" :
271
- // Typical form.
272
- if err := input .Request .ParseForm (); err != nil {
273
- return errors .New ("Error parsing request body:" + err .Error ())
274
- }
275
-
276
- case "multipart/form-data" :
270
+ if strings .Contains (input .Header ("Content-Type" ), "multipart/form-data" ) {
277
271
if err := input .Request .ParseMultipartForm (maxMemory ); err != nil {
278
272
return errors .New ("Error parsing request body:" + err .Error ())
279
273
}
274
+ } else if err := input .Request .ParseForm (); err != nil {
275
+ return errors .New ("Error parsing request body:" + err .Error ())
280
276
}
281
-
282
277
return nil
283
278
}
You can’t perform that action at this time.
0 commit comments