Documentation ¶
Overview ¶
A codec for handling JSONP encoding.
Index ¶
- Variables
- type JsonPCodec
- func (c *JsonPCodec) CanMarshalWithCallback() bool
- func (c *JsonPCodec) ContentType() string
- func (c *JsonPCodec) ContentTypeSupported(contentType string) bool
- func (c *JsonPCodec) FileExtension() string
- func (c *JsonPCodec) Marshal(object interface{}, options map[string]interface{}) ([]byte, error)
- func (c *JsonPCodec) Unmarshal(data []byte, obj interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorMissingCallback = errors.New("A callback is required for JSONP")
ErrorMissingCallback is the error for when a callback option is expected but missing.
View Source
var ErrorUnmarshalNotSupported = errors.New("Unmarshalling an object is not supported for JSONP")
ErrorUnmarshalNotSupported is the error for when Unmarshal is called but not supported.
Functions ¶
This section is empty.
Types ¶
type JsonPCodec ¶
type JsonPCodec struct{}
JsonPCodec converts objects to JSONP.
func (*JsonPCodec) CanMarshalWithCallback ¶
func (c *JsonPCodec) CanMarshalWithCallback() bool
CanMarshalWithCallback returns whether this codec is capable of marshalling a response containing a callback.
func (*JsonPCodec) ContentType ¶
func (c *JsonPCodec) ContentType() string
ContentType returns the content type for this codec.
func (*JsonPCodec) ContentTypeSupported ¶
func (c *JsonPCodec) ContentTypeSupported(contentType string) bool
func (*JsonPCodec) FileExtension ¶
func (c *JsonPCodec) FileExtension() string
FileExtension returns the file extension for this codec.
func (*JsonPCodec) Marshal ¶
func (c *JsonPCodec) Marshal(object interface{}, options map[string]interface{}) ([]byte, error)
Marshal converts an object to JSONP.
func (*JsonPCodec) Unmarshal ¶
func (c *JsonPCodec) Unmarshal(data []byte, obj interface{}) error
Unmarshal is not supported for JSONP. Returns an error.
Click to show internal directories.
Click to hide internal directories.