Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthcheckHandler ¶
func HealthcheckHandler(w http.ResponseWriter, r *http.Request)
HealthcheckHandler just prints "heartbeat" to confirm the server is running
func MandelPngHandlerGenerator ¶
func MandelPngHandlerGenerator(drawer mandelbrot.Drawer) func(w http.ResponseWriter, r *http.Request)
MandelPngHandlerGenerator takes a Drawer and returns a HttpRequestHandler. This pattern supports dependency injection for testing.
func Serve ¶
func Serve(port int)
Serve starts a server that supports healthcheck and a mandelbrot-png endpoint
func WriteImage ¶
func WriteImage(w http.ResponseWriter, img *image.RGBA)
WriteImage writes an image to a ResponseWriter and sets headers
Types ¶
type DefaultMap ¶
DefaultMap is a string map that supports get-with-default operations
func NewDefaultMap ¶
func NewDefaultMap(input url.Values) DefaultMap
NewDefaultMap makes a map that supports get-with-default
func (DefaultMap) GetDefaultFloat64 ¶
func (d DefaultMap) GetDefaultFloat64(key string, otherwise float64) float64
GetDefaultFloat64 gets a float from the DefaultMap if it exists and is a float, otherwise returning the default
func (DefaultMap) GetDefaultInt ¶
func (d DefaultMap) GetDefaultInt(key string, otherwise int) int
GetDefaultInt gets an int from the DefaultMap if it exists and is an int, otherwise returning the default