route

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: MIT Imports: 6 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.0

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.

Jump to

Keyboard shortcuts

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