Documentation
¶
Overview ¶
Package test implements utilities for testing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerPath ¶
type HandlerPath struct { Method string Path string Response string ResponseHandler func(http.ResponseWriter, *http.Request) ResponseCode int }
func (*HandlerPath) HandlerFunc ¶
func (hp *HandlerPath) HandlerFunc() func(http.ResponseWriter, *http.Request)
type HandlerSet ¶
type HandlerSet struct {
// contains filtered or unexported fields
}
HandlerSet is a struct with a mutex that allows us to swap handlers while a test server is running
func (*HandlerSet) ServeHTTP ¶
func (hs *HandlerSet) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves HTTP using the handler
func (*HandlerSet) SetHandler ¶
func (hs *HandlerSet) SetHandler(handler http.Handler)
SetHandler sets the handler to `handler`
type Server ¶
Server wraps a HTTP test server
func NewServerWithHandles ¶
func NewServerWithHandles(hps []HandlerPath, listener net.Listener) *Server
NewServerWithHandles creates a new test servers with path and responses
Click to show internal directories.
Click to hide internal directories.