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

Method CBOR

bind.go:317–327  ·  view source on GitHub ↗

CBOR binds the body string into the struct. Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).

(out any)

Source from the content-addressed store, hash-verified

315// CBOR binds the body string into the struct.
316// Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).
317func (b *Bind) CBOR(out any) error {
318 bind := binder.GetFromThePool[*binder.CBORBinding](&binder.CBORBinderPool)
319 bind.CBORDecoder = b.ctx.App().Config().CBORDecoder
320
321 defer releasePooledBinder(&binder.CBORBinderPool, bind)
322
323 if err := b.returnBindErr(bind.Bind(b.ctx.Body(), out), BindSourceBody); err != nil {
324 return err
325 }
326 return b.validateStruct(out)
327}
328
329// XML binds the body string into the struct.
330// Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).

Callers 1

BodyMethod · 0.95

Calls 7

returnBindErrMethod · 0.95
validateStructMethod · 0.95
releasePooledBinderFunction · 0.85
ConfigMethod · 0.65
AppMethod · 0.65
BindMethod · 0.65
BodyMethod · 0.65

Tested by

no test coverage detected