Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer is a server which we can program to behave like netmaster for testing purposes.
func NewMockServer ¶
func NewMockServer() *MockServer
NewMockServer returns a configured, initialized, and running MockServer which can have routes added even though it's already running. Call Stop() to stop it.
func (*MockServer) AddHandler ¶
func (ms *MockServer) AddHandler(path string, f func(http.ResponseWriter, *http.Request))
AddHandler allows adding a custom route handler to our custom ServeMux
func (*MockServer) AddHardcodedResponse ¶
func (ms *MockServer) AddHardcodedResponse(path string, body []byte)
AddHardcodedResponse registers a HTTP handler func for `path' that returns `body'.
func (*MockServer) Init ¶
func (ms *MockServer) Init()
Init just sets up the stop channel and our custom ServeMux
func (*MockServer) Serve ¶
func (ms *MockServer) Serve()
Serve starts the mock server using the custom ServeMux we set up.
Click to show internal directories.
Click to hide internal directories.