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

Method Form

bind.go:348–360  ·  view source on GitHub ↗

Form binds the form into the struct, map[string]string and map[string][]string. Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode). If Content-Type is "application/x-www-form-urlencoded" or "multipart/form-data", it will bind the form values. Multipart f

(out any)

Source from the content-addressed store, hash-verified

346// If Content-Type is "application/x-www-form-urlencoded" or "multipart/form-data", it will bind the form values.
347// Multipart file fields are supported using *multipart.FileHeader, []*multipart.FileHeader, or *[]*multipart.FileHeader.
348func (b *Bind) Form(out any) error {
349 bind := binder.GetFromThePool[*binder.FormBinding](&binder.FormBinderPool)
350 bind.EnableSplitting = b.ctx.App().config.EnableSplittingOnParsers
351 bind.MaxBodySize = b.ctx.App().config.BodyLimit
352
353 defer releasePooledBinder(&binder.FormBinderPool, bind)
354
355 if err := b.returnBindErr(bind.Bind(&b.ctx.RequestCtx().Request, out), BindSourceBody); err != nil {
356 return err
357 }
358
359 return b.validateStruct(out)
360}
361
362// URI binds the route parameters into the struct, map[string]string and map[string][]string.
363// Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).

Callers 3

BodyMethod · 0.95
WithInputMethod · 0.80

Calls 6

returnBindErrMethod · 0.95
validateStructMethod · 0.95
releasePooledBinderFunction · 0.85
AppMethod · 0.65
BindMethod · 0.65
RequestCtxMethod · 0.65

Tested by 1