Documentation ¶
Overview ¶
Package serve provides a wrapper of net/http.Handler to be used as a filter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeHTTP ¶
func ServeHTTP(ctx filters.FilterContext, h http.Handler)
Creates a response from a handler and a request.
It calls the handler's ServeHTTP method with an internal response writer that shares the status code, headers and the response body with the returned response. It blocks until the handler calls the response writer's WriteHeader, or starts writing the body, or returns. The written body is not buffered, but piped to the returned response's body.
Example, a simple file server:
var handler = http.StripPrefix(webRoot, http.FileServer(http.Dir(root))) func (f *myFilter) Request(ctx filters.FilterContext) { serve.ServeHTTP(ctx, handler) }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.