Version: v0.0.0-...-17ac0a5 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2017 License: Apache-2.0 Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


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.

func (*MockServer) Stop

func (ms *MockServer) Stop()

Stop stops the mock server.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL