Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
IP string
Port int
PortTLS int
ConfigTLS string
Resolver Resolver
Translator translate.MessageTranslator
Processor vars.Processor
Scenario scenario.Director
Spier match.Spier
Mlog chan definition.Match
}
Dispatcher is the mock http server
func (*Dispatcher) ServeHTTP ¶
func (di *Dispatcher) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServerHTTP is the mock http server request handler. It uses the router to decide the matching mock and translator as adapter between the HTTP impelementation and the mock definition.
type Resolver ¶
type Resolver interface {
Resolve(req *definition.Request) (*definition.Mock, *definition.MatchResult)
}
Resolver contains the functions to check the http request and return the matching mock.
type Router ¶
type Router struct {
Mapping definition.Mapping
Checker match.Checker
}
Router checks http requesta and try to figure out what is the best mock for each one.
func NewRouter ¶
func NewRouter(mapping definition.Mapping, checker match.Checker) *Router
NewRouter returns a pointer to new Router
func (*Router) Resolve ¶
func (rr *Router) Resolve(req *definition.Request) (*definition.Mock, *definition.MatchResult)
Route checks the request with all available mock definitions and return the matching mock for it.
Click to show internal directories.
Click to hide internal directories.