Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncoderXML ¶
type EncoderXML struct { // MaxBodySize is the maximum size (in bytes) of XML content to be read (io.Reader) // Defaults to 4194304 (4MB) MaxBodySize int64 // Indented indicates whether or not to output indented XML. // Defaults to false Indented bool // AcceptHeader is the media type used in Accept HTTP header. // Defaults to "application/xml" AcceptHeader string // ContentTypeHeader is the media type used in Content-Type HTTP header // Defaults to "application/xml;charset=utf-8" ContentTypeHeader string }
EncoderXML implements the relax.Encoder interface. It encode/decodes XML.
func NewEncoderXML ¶
func NewEncoderXML() *EncoderXML
NewEncoderXML returns an EncoderXML object. This function will initiallize the object with sane defaults, for use with Service.encoders. Returns the new EncoderXML object.
func (*EncoderXML) Accept ¶
func (e *EncoderXML) Accept() string
Accept returns the media type for XML content, used in Accept header.
func (*EncoderXML) ContentType ¶
func (e *EncoderXML) ContentType() string
ContentType returns the media type for XML content, used in the Content-Type header.
func (*EncoderXML) Decode ¶
func (e *EncoderXML) Decode(reader io.Reader, v interface{}) error
Decode reads an XML payload (usually from Request.Body) and tries to set it to a variable v. If the payload is too large, with maximum EncoderXML.MaxBodySize, it will fail with error ErrBodyTooLarge Returns nil on success and error on failure.