Documentation ¶
Index ¶
- Constants
- Variables
- func BindFormatter(t string, f Formatter)
- func Decode(t string, r *http.Request, i interface{}) error
- func Encode(accepts string, i interface{}) (string, string, error)
- func ParseAcceptHeader(accept string) []string
- func RemoveFormatter(t string)
- type Form
- type Formatter
- type JSON
- type XML
- type YAML
Constants ¶
View Source
const FormResourceType string = "application/x-www-form-urlencoded"
View Source
const JSONResourceType string = "application/json"
View Source
const XMLResourceType string = "application/xml"
View Source
const YAMLResourceType string = "application/yaml"
Variables ¶
View Source
var DefaultRequestFormatter = JSONResourceType
DefaultRequestFormatter defines the default decoding in the absence of headers
View Source
var DefaultResponseFormatter = JSONResourceType
DefaultResponseFormatter defines the default encoding in the absence of headers
Functions ¶
func BindFormatter ¶
BindFormatter Bind an alternate formatter implementation
func ParseAcceptHeader ¶
ParseAcceptHeader Parses an HTTP accept header to return an ordered list of content types
func RemoveFormatter ¶
func RemoveFormatter(t string)
RemoveFormatter Remove a formatter implementation
Types ¶
type Formatter ¶
type Formatter interface { Encode(o interface{}) (string, error) Decode(r *http.Request, i interface{}) error }
Formatter Defines a formatter interface
Click to show internal directories.
Click to hide internal directories.