Documentation ¶
Overview ¶
Package responder respond differently according to request's accepted mime type
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Responder ¶
type Responder struct { DefaultResponder func() // contains filtered or unexported fields }
Responder is holder of registed response handlers, response `Request` based on its accepted mime type
func With ¶
func With(formats interface{}, fc func()) *Responder
With could be used to register response handler for mime type formats, the formats could be string or []string
responder.With("html", func() { writer.Write([]byte("this is a html request")) }).With([]string{"json", "xml"}, func() { writer.Write([]byte("this is a json or xml request")) })
Click to show internal directories.
Click to hide internal directories.