File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -269,14 +269,13 @@ func (r *Request) parseForm() {
269269 return
270270 }
271271 if contentType := r .Header .Get ("Content-Type" ); contentType != "" {
272- var (
273- err error
274- repeatableRead = true
275- )
276- if gstr .Contains (contentType , "multipart/" ) {
272+ var err error
273+ if ! gstr .Contains (contentType , "multipart/" ) {
277274 // To avoid big memory consuming.
278275 // The `multipart/` type form always contains binary data, which is not necessary read twice.
279- repeatableRead = false
276+ r .MakeBodyRepeatableRead (true )
277+ }
278+ if gstr .Contains (contentType , "multipart/" ) {
280279 // multipart/form-data, multipart/mixed
281280 if err = r .ParseMultipartForm (r .Server .config .FormParsingMemory ); err != nil {
282281 panic (gerror .WrapCode (gcode .CodeInvalidRequest , err , "r.ParseMultipartForm failed" ))
@@ -287,9 +286,6 @@ func (r *Request) parseForm() {
287286 panic (gerror .WrapCode (gcode .CodeInvalidRequest , err , "r.Request.ParseForm failed" ))
288287 }
289288 }
290- if repeatableRead {
291- r .MakeBodyRepeatableRead (true )
292- }
293289 if len (r .PostForm ) > 0 {
294290 // Parse the form data using united parsing way.
295291 params := ""
You can’t perform that action at this time.
0 commit comments