Documentation ¶
Index ¶
- Variables
- type Cassette
- func (c *Cassette) AddInteraction(i *Interaction)
- func (c *Cassette) GetInteraction(r *http.Request) (*Interaction, error)
- func (c *Cassette) HasRequest(url string) bool
- func (c *Cassette) RequestFinished(url string)
- func (c *Cassette) RequestStated(url string)
- func (c *Cassette) Requests() []string
- func (c *Cassette) Save() error
- func (c *Cassette) SetMatcher(m Matcher)
- type DefaultMatcher
- type Interaction
- type Matcher
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var (
InteractionNotFound = errors.New("Requested interaction not found")
)
Functions ¶
This section is empty.
Types ¶
type Cassette ¶
type Cassette struct { // Name of the cassette Name string `yaml:"-"` // File name of the cassette as written on disk File string `yaml:"-"` // Cassette format version Version int `yaml:"version"` // Interactions between client and server Interactions []*Interaction `yaml:"interactions"` // Interactions mutex InteractionsMu sync.Mutex `yaml:"-"` // Unfinished requests mutex UnfinishedRequests sync.RWMutex `yaml:"-"` // Closed by client or hanging requests UnclosedRequests map[string]interface{} `yaml:"unclosed_requests"` }
Cassette type
func (*Cassette) AddInteraction ¶
func (c *Cassette) AddInteraction(i *Interaction)
Adds a new interaction to the cassette
func (*Cassette) GetInteraction ¶
func (c *Cassette) GetInteraction(r *http.Request) (*Interaction, error)
Gets a recorded interaction
func (*Cassette) HasRequest ¶
func (*Cassette) RequestFinished ¶
func (*Cassette) RequestStated ¶
type DefaultMatcher ¶
type DefaultMatcher struct {
Matcher
}
func (*DefaultMatcher) Match ¶
func (m *DefaultMatcher) Match(interactions []*Interaction, r *http.Request) ( *Interaction, error)
type Interaction ¶
Interaction type contains a pair of request/response for a single HTTP interaction between a client and a server
type Matcher ¶
type Matcher interface { Match(interactions []*Interaction, r *http.Request) (*Interaction, error) MatchUrlStrings(expected, actual string) bool }
Click to show internal directories.
Click to hide internal directories.