Documentation ¶
Overview ¶
Package handler is a collection of useful http.Handlers
The following subpackages contain:
- log - handlers for logging requests and panics
- encoding - a handler for using gzip compression on the response
- lang - a handler for setting up i18n urls
The package itself contains some common interfaces and useful types used by all handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Print(v ...interface{})
}
A Logger interface is used by handlers to when some kind of output needs to be provided
func ErrLogger ¶
func ErrLogger() Logger
ErrLogger returns a Logger implementation that outputs to os.Stderr
type ResponseWrapper ¶
type ResponseWrapper struct { *httptest.ResponseRecorder // Hijacked will be set to true if the original http.ResponseWriter was // hijacked successfully. Hijacked bool // contains filtered or unexported fields }
ResponseWrapper is a simple wrapper around httptest.ResponseRecorder, implementing the http.Hijacker interface.
func NewResponseWrapper ¶
func NewResponseWrapper(w http.ResponseWriter) *ResponseWrapper
NewResponseWrapper creates a new wrapper. The passed http.ResponseWriter is used in case the wrapper needs to be hijacked.
func (*ResponseWrapper) CloseNotify ¶ added in v0.8.3
func (w *ResponseWrapper) CloseNotify() <-chan bool
CloseNotify tries to use the original http.ResponseWriter for close notification. If the original writer doesn't implement http.CloseNotifier, it returns a channel that will never close.
func (*ResponseWrapper) Hijack ¶
func (w *ResponseWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack tries to use the original http.ResponseWriter for hijacking. If the original writer doesn't implement http.Hijacker, it returns an error.
Directories ¶
Path | Synopsis |
---|---|
Package encoding provides an handler that compresses the response body using gzip.
|
Package encoding provides an handler that compresses the response body using gzip. |
Package language contains a handler that provides support for handling requests in specific languages.
|
Package language contains a handler that provides support for handling requests in specific languages. |
Package log provides handlers for logging request access and panics.
|
Package log provides handlers for logging request access and panics. |