Documentation ¶
Overview ¶
Package planner provides functionalities for deciding what expectation matches the given request.
Index ¶
- func MatchBody(expected Expectation, actual *http.Request) (err error)
- func MatchHeader(expected Expectation, actual *http.Request) (err error)
- func MatchMethod(expected Expectation, actual *http.Request) (err error)
- func MatchRequest(expected Expectation, actual *http.Request) error
- func MatchURI(expected Expectation, actual *http.Request) (err error)
- type Error
- type Expectation
- type Planner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchBody ¶
func MatchBody(expected Expectation, actual *http.Request) (err error)
MatchBody matches the payload of a given request.
func MatchHeader ¶
func MatchHeader(expected Expectation, actual *http.Request) (err error)
MatchHeader matches the header of a given request.
func MatchMethod ¶
func MatchMethod(expected Expectation, actual *http.Request) (err error)
MatchMethod matches the method of a given request.
func MatchRequest ¶
func MatchRequest(expected Expectation, actual *http.Request) error
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 Expectation ¶ added in v0.10.0
type Expectation interface { Method() string URIMatcher() matcher.Matcher HeaderMatcher() matcher.HeaderMatcher BodyMatcher() *matcher.BodyMatcher RemainTimes() uint Fulfilled() FulfilledTimes() uint }
Expectation is an interface that represents an expectation.
type Planner ¶
type Planner interface { // IsEmpty checks whether the planner has no expectation. IsEmpty() bool // Expect adds a new expectation. Expect(e Expectation) // Plan decides how a request matches an expectation. Plan(req *http.Request) (Expectation, error) // Remain returns remain expectations. Remain() []Expectation // 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.