Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestRouter ¶
type RequestRouter struct { Mocks []definition.Mock Matcher match.Matcher DUpdates chan []definition.Mock sync.Mutex }
RequestRouter checks http requesta and try to figure out what is the best mock for each one.
func NewRouter ¶
func NewRouter(mocks []definition.Mock, matcher match.Matcher, dUpdates chan []definition.Mock) *RequestRouter
NewRouter returns a pointer to new RequestRouter
func (*RequestRouter) Copy ¶ added in v1.0.1
func (rr *RequestRouter) Copy(src, dst *definition.Mock)
func (*RequestRouter) MockChangeWatch ¶
func (rr *RequestRouter) MockChangeWatch()
MockChangeWatch monitors the mock configuration dir and loads again all the mocks it something change.
func (*RequestRouter) Route ¶
func (rr *RequestRouter) Route(req *definition.Request) (*definition.Mock, map[string]string)
Route checks the request with all available mock definitions and return the matching mock for it.
func (*RequestRouter) SetMockDefinitions ¶
func (rr *RequestRouter) SetMockDefinitions(mocks []definition.Mock)
SetMockDefinitions allows replace the current mock definitions for new ones.
type Router ¶
type Router interface { Route(req *definition.Request) (*definition.Mock, map[string]string) SetMockDefinitions(mocks []definition.Mock) }
Router contains the functions to check the http request and return the matching mock.
Click to show internal directories.
Click to hide internal directories.