mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
@ -269,8 +269,14 @@ func (r *Request) parseForm() {
|
||||
return
|
||||
}
|
||||
if contentType := r.Header.Get("Content-Type"); contentType != "" {
|
||||
var err error
|
||||
var (
|
||||
err error
|
||||
repeatableRead = true
|
||||
)
|
||||
if gstr.Contains(contentType, "multipart/") {
|
||||
// To avoid big memory consuming.
|
||||
// The `multipart/` type form always contains binary data, which is not necessary read twice.
|
||||
repeatableRead = false
|
||||
// multipart/form-data, multipart/mixed
|
||||
if err = r.ParseMultipartForm(r.Server.config.FormParsingMemory); err != nil {
|
||||
panic(gerror.WrapCode(gcode.CodeInvalidRequest, err, "r.ParseMultipartForm failed"))
|
||||
@ -281,6 +287,9 @@ func (r *Request) parseForm() {
|
||||
panic(gerror.WrapCode(gcode.CodeInvalidRequest, err, "r.Request.ParseForm failed"))
|
||||
}
|
||||
}
|
||||
if repeatableRead {
|
||||
r.MakeBodyRepeatableRead(true)
|
||||
}
|
||||
if len(r.PostForm) > 0 {
|
||||
// Parse the form data using united parsing way.
|
||||
params := ""
|
||||
|
||||
@ -52,6 +52,7 @@ func Map(value interface{}, option ...MapOption) map[string]interface{} {
|
||||
// Deprecated: used Map instead.
|
||||
func MapDeep(value interface{}, tags ...string) map[string]interface{} {
|
||||
return doMapConvert(value, recursiveTypeTrue, false, MapOption{
|
||||
Deep: true,
|
||||
Tags: tags,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user