fiber/binder/cbor.go
RW fe1bf4a0b3
feat(ctx): add conditional copy helpers (#3703)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-26 07:54:15 +02:00

34 lines
866 B
Go

package binder
import (
utils "github.com/gofiber/utils/v2"
)
// CBORBinding is the CBOR binder for CBOR request body.
type CBORBinding struct {
CBORDecoder utils.CBORUnmarshal
}
// Name returns the binding name.
func (*CBORBinding) Name() string {
return "cbor"
}
// Bind parses the request body as CBOR and returns the result.
func (b *CBORBinding) Bind(body []byte, out any) error {
return b.CBORDecoder(body, out)
}
// Reset resets the CBORBinding binder.
func (b *CBORBinding) Reset() {
b.CBORDecoder = nil
}
func UnimplementedCborMarshal(_ any) ([]byte, error) {
panic("Must explicitly setup CBOR, please check docs: https://docs.gofiber.io/next/guide/advance-format#cbor")
}
func UnimplementedCborUnmarshal(_ []byte, _ any) error {
panic("Must explicitly setup CBOR, please check docs: https://docs.gofiber.io/next/guide/advance-format#cbor")
}