Documentation ¶
Index ¶
- Variables
- func CachableHelloHandler(w http.ResponseWriter, r *http.Request)
- func ErrorHandler(w http.ResponseWriter, r *http.Request)
- func HangingHandler(w http.ResponseWriter, r *http.Request)
- func HelloHandler(w http.ResponseWriter, r *http.Request)
- func Start(s http.Handler) (string, error)
- func StartServer(h Handler) (*http.ServeMux, string, error)
- func StartServerURL(h Handler) (*http.ServeMux, *url.URL, error)
- func StartURL(s http.Handler) (*url.URL, error)
- func TimeoutHandler(w http.ResponseWriter, r *http.Request)
- type Handler
- func CachableFileHandler(file string) Handler
- func CachableStringHandler(message string) Handler
- func CachableTestDataHandler(file string) Handler
- func FileHandler(file string) Handler
- func Slow(d time.Duration, h Handler) Handler
- func StringHandler(message string) Handler
- func TestDataHandler(file string) Handler
- type Recorder
Constants ¶
This section is empty.
Variables ¶
var CacheTime = time.Unix(10, 0)
Functions ¶
func CachableHelloHandler ¶
func CachableHelloHandler(w http.ResponseWriter, r *http.Request)
Always returns the string "hello", with headers that allow caching.
func ErrorHandler ¶
func ErrorHandler(w http.ResponseWriter, r *http.Request)
ErrorHandler returns a StatusInternalServerError.
func HangingHandler ¶
func HangingHandler(w http.ResponseWriter, r *http.Request)
HangingHandler hangs forever.
func HelloHandler ¶
func HelloHandler(w http.ResponseWriter, r *http.Request)
Always returns the string "hello".
func StartServer ¶
StartServer is just like Start, excepts it creates and returns a new mux.
func StartServerURL ¶
StartServerURL is like StartURL, except it creates and returns a new mux.
func StartURL ¶
StartURL starts an http server listening on a random port.
Uses the supplied http.Handler to serve pages, returns the full URL it is listening on.
func TimeoutHandler ¶
func TimeoutHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type Handler ¶
type Handler func(w http.ResponseWriter, r *http.Request)
func CachableStringHandler ¶
CachableStringHandler reeturns a string, adding headers that allow client caching.
func CachableTestDataHandler ¶
Returns a file from the "testdata" directory", cachable.
func Slow ¶
Slow will slow down the responses by the specified amount. Convenient to try to trigger timeouts, or race conditions.
func StringHandler ¶
StringHandler just reeturns a string, WITHOUT any header that allows caching.
func TestDataHandler ¶
Returns a file from the "testdata" directory", not cachable.