Documentation ¶
Overview ¶
Package matchers implements matchers for http response matching with templates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConditionTypes = map[string]ConditionType{ "and": ANDCondition, "or": ORCondition, }
ConditionTypes is an table for conversion of condition type from string.
View Source
var MatcherTypes = map[string]MatcherType{ "status": StatusMatcher, "size": SizeMatcher, "word": WordsMatcher, "regex": RegexMatcher, "binary": BinaryMatcher, "dsl": DSLMatcher, }
MatcherTypes is an table for conversion of matcher type from string.
View Source
var PartTypes = map[string]Part{ "body": BodyPart, "header": HeaderPart, "all": AllPart, }
PartTypes is an table for conversion of part type from string.
Functions ¶
This section is empty.
Types ¶
type ConditionType ¶
type ConditionType int
ConditionType is the type of condition for matcher
const ( // ANDCondition matches responses with AND condition in arguments. ANDCondition ConditionType = iota + 1 // ORCondition matches responses with AND condition in arguments. ORCondition )
type Matcher ¶
type Matcher struct { // Type is the type of the matcher Type string `yaml:"type"` // Name is matcher Name to be displayed in result output. Name string `yaml:"name,omitempty"` // Status are the acceptable status codes for the response Status []int `yaml:"status,omitempty"` // Size is the acceptable size for the response Size []int `yaml:"size,omitempty"` // Words are the words required to be present in the response Words []string `yaml:"words,omitempty"` // Regex are the regex pattern required to be present in the response Regex []string `yaml:"regex,omitempty"` // Binary are the binary characters required to be present in the response Binary []string `yaml:"binary,omitempty"` // DSL are the dsl queries DSL []string `yaml:"dsl,omitempty"` // Condition is the optional condition between two matcher variables // // By default, the condition is assumed to be OR. Condition string `yaml:"condition,omitempty"` // Part is the part of the request to match // // By default, matching is performed in request body. Part string `yaml:"part,omitempty"` // contains filtered or unexported fields }
Matcher is used to identify whether a template was successful.
func (*Matcher) CompileMatchers ¶
CompileMatchers performs the initial setup operation on a matcher
type MatcherType ¶
type MatcherType = int
MatcherType is the type of the matcher specified
const ( // WordsMatcher matches responses with words WordsMatcher MatcherType = iota + 1 // RegexMatcher matches responses with regexes RegexMatcher // BinaryMatcher matches responses with words BinaryMatcher // StatusMatcher matches responses with status codes StatusMatcher // SizeMatcher matches responses with response size SizeMatcher // DSLMatcher matches based upon dsl syntax DSLMatcher )
Click to show internal directories.
Click to hide internal directories.