jsonp

package
v0.0.0-...-86643de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2019 License: BSD-2-Clause Imports: 4 Imported by: 2

Documentation

Overview

A codec for handling JSONP encoding.

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL