bindMultipart parses the request body and returns the result.
(req *fasthttp.Request, out any)
| 61 | |
| 62 | // bindMultipart parses the request body and returns the result. |
| 63 | func (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. |
| 93 | func (b *FormBinding) Reset() { |
no test coverage detected