MCPcopy
hub / github.com/gofiber/fiber / bindMultipart

Method bindMultipart

binder/form.go:63–90  ·  view source on GitHub ↗

bindMultipart parses the request body and returns the result.

(req *fasthttp.Request, out any)

Source from the content-addressed store, hash-verified

61
62// bindMultipart parses the request body and returns the result.
63func (b *FormBinding) bindMultipart(req *fasthttp.Request, out any) error {
64 multipartForm, err := req.MultipartFormWithLimit(b.MaxBodySize)
65 if err != nil {
66 return err
67 }
68
69 data := acquireDataMap()
70 defer releaseDataMap(data)
71
72 for key, values := range multipartForm.Value {
73 err = formatBindData(b.Name(), out, data, key, values, b.EnableSplitting, true)
74 if err != nil {
75 return err
76 }
77 }
78
79 files := acquireFileHeaderMap()
80 defer releaseFileHeaderMap(files)
81
82 for key, values := range multipartForm.File {
83 err = formatBindData(b.Name(), out, files, key, values, b.EnableSplitting, true)
84 if err != nil {
85 return err
86 }
87 }
88
89 return parse(b.Name(), out, data, files)
90}
91
92// Reset resets the FormBinding binder.
93func (b *FormBinding) Reset() {

Callers 1

BindMethod · 0.95

Calls 7

NameMethod · 0.95
acquireDataMapFunction · 0.85
releaseDataMapFunction · 0.85
formatBindDataFunction · 0.85
acquireFileHeaderMapFunction · 0.85
releaseFileHeaderMapFunction · 0.85
parseFunction · 0.85

Tested by

no test coverage detected