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

Method Cookie

bind.go:272–283  ·  view source on GitHub ↗

Cookie binds the request cookie strings 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). NOTE: If your cookie is like key=val1,val2; they'll be bound as a slice if your map is map[string][]st

(out any)

Source from the content-addressed store, hash-verified

270// Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).
271// NOTE: If your cookie is like key=val1,val2; they'll be bound as a slice if your map is map[string][]string. Else, it'll use last element of cookie.
272func (b *Bind) Cookie(out any) error {
273 bind := binder.GetFromThePool[*binder.CookieBinding](&binder.CookieBinderPool)
274 bind.EnableSplitting = b.ctx.App().config.EnableSplittingOnParsers
275
276 defer releasePooledBinder(&binder.CookieBinderPool, bind)
277
278 if err := b.returnBindErr(bind.Bind(&b.ctx.RequestCtx().Request, out), BindSourceCookie); err != nil {
279 return err
280 }
281
282 return b.validateStruct(out)
283}
284
285// Query binds the query string into the struct, map[string]string and map[string][]string.
286// Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected