Documentation
¶
Overview ¶
Package planner provides functionalities for deciding what expectation matches the given request.
Index ¶
- func MatchBody(expected *request.Request, actual *http.Request) (err error)
- func MatchHeader(expected *request.Request, actual *http.Request) (err error)
- func MatchMethod(expected *request.Request, actual *http.Request) (err error)
- func MatchRequest(expected *request.Request, actual *http.Request) error
- func MatchURI(expected *request.Request, actual *http.Request) (err error)
- type Error
- type Planner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchHeader ¶
MatchHeader matches the header of a given request.
func MatchMethod ¶
MatchMethod matches the method of a given request.
func MatchRequest ¶
MatchRequest checks whether a request is matched.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents an error that occurs while matching a request.
type Planner ¶
type Planner interface {
// IsEmpty checks whether the planner has no expectation.
IsEmpty() bool
// Expect adds a new expectation.
Expect(expect *request.Request)
// Plan decides how a request matches an expectation.
Plan(req *http.Request) (*request.Request, error)
// Remain returns remain expectations.
Remain() []*request.Request
// Reset removes all the expectations.
Reset()
}
Planner or Request Execution Planner is in charge of selecting the right expectation for a given request.
Click to show internal directories.
Click to hide internal directories.