Documentation
¶
Index ¶
- func CookiesToMap(cookies []*http.Cookie) map[string]string
- func GenerateTraceparent() string
- func LoadMethods(methodNames string) []string
- func ParseQuery(values url.Values) map[string]map[string]string
- func StringWithCharset(length int, charset string) string
- func ToSingleValueMap(values map[string][]string) map[string]string
- type AbsentRule
- type AndCondition
- type BlockRule
- type Condition
- type ContainsRule
- type DataCondition
- type DataContext
- type DateTimeRule
- type EqualToBaseRule
- type EqualToBinaryRule
- type EqualToJsonRule
- type EqualToRule
- type EqualToXmlRule
- type FalseRule
- type FileDataCondition
- type FileFormData
- type Filter
- type MatchesBaseXPathRule
- type MatchesJsonXPathRule
- type MatchesXmlXPathRule
- type MockData
- type MockRequest
- type MultiDataCondition
- type MultiFilter
- type MultipartPatternsData
- type NotRule
- type OrCondition
- type ParsedConditions
- type ParsedRules
- type RegExRule
- type RequestData
- type Rule
- type TrueRule
- type WildcardsRule
- type XPathFactory
- type XPathFilter
- type XPathFilterProps
- type XPathJsonFactory
- type XPathXmlFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTraceparent ¶ added in v0.6.6
func GenerateTraceparent() string
func LoadMethods ¶ added in v0.6.8
func StringWithCharset ¶
Types ¶
type AbsentRule ¶
type AbsentRule struct { }
type AndCondition ¶
type AndCondition struct {
// contains filtered or unexported fields
}
func (AndCondition) Check ¶ added in v0.6.8
func (c AndCondition) Check() (bool, error)
type BlockRule ¶ added in v1.0.0
type BlockRule struct {
// contains filtered or unexported fields
}
type ContainsRule ¶
type ContainsRule struct {
// contains filtered or unexported fields
}
type DataCondition ¶
type DataCondition struct {
// contains filtered or unexported fields
}
func (DataCondition) Check ¶ added in v0.6.8
func (c DataCondition) Check() (bool, error)
type DataContext ¶
type DateTimeRule ¶
type DateTimeRule struct {
// contains filtered or unexported fields
}
type EqualToBaseRule ¶ added in v1.0.0
type EqualToBinaryRule ¶
type EqualToBinaryRule struct {
// contains filtered or unexported fields
}
type EqualToJsonRule ¶
type EqualToJsonRule struct { EqualToBaseRule // contains filtered or unexported fields }
type EqualToRule ¶
type EqualToRule struct {
// contains filtered or unexported fields
}
type EqualToXmlRule ¶
type EqualToXmlRule struct { EqualToBaseRule // contains filtered or unexported fields }
type FileDataCondition ¶ added in v1.0.0
type FileDataCondition struct {
// contains filtered or unexported fields
}
func (FileDataCondition) Check ¶ added in v1.0.0
func (c FileDataCondition) Check() (bool, error)
type FileFormData ¶ added in v1.0.0
type Filter ¶
type Filter struct { Contains *string `json:"contains,omitempty" bson:"contains,omitempty"` EqualTo *string `json:"equalTo,omitempty" bson:"equalTo,omitempty"` CaseInsensitive *bool `json:"caseInsensitive,omitempty" bson:"caseInsensitive,omitempty"` BinaryEqualTo *string `json:"binaryEqualTo,omitempty" bson:"binaryEqualTo,omitempty"` DoesNotContain *string `json:"doesNotContain,omitempty" bson:"doesNotContain,omitempty"` Matches *string `json:"matches,omitempty" bson:"matches,omitempty"` DoesNotMatch *string `json:"doesNotMatch,omitempty" bson:"doesNotMatch,omitempty"` Absent *bool `json:"absent,omitempty" bson:"absent,omitempty"` And []Filter `json:"and,omitempty" bson:"and,omitempty"` Or []Filter `json:"or,omitempty" bson:"or,omitempty"` Before *time.Time `json:"before,omitempty" bson:"before,omitempty"` // "2021-05-01T00:00:00Z" After *time.Time `json:"after,omitempty" bson:"after,omitempty"` // "2021-05-01T00:00:00Z" EqualToDateTime *time.Time `json:"equalToDateTime,omitempty" bson:"equalToDateTime,omitempty"` ActualFormat *string `json:"actualFormat,omitempty" bson:"actualFormat,omitempty"` EqualToJson *string `json:"equalToJson,omitempty" bson:"equalToJson,omitempty"` IgnoreArrayOrder *bool `json:"ignoreArrayOrder,omitempty" bson:"ignoreArrayOrder,omitempty"` IgnoreExtraElements *bool `json:"ignoreExtraElements,omitempty" bson:"ignoreExtraElements,omitempty"` // TODO - implement with https://pkg.go.dev/github.com/PaesslerAG/jsonpath // MatchesJsonPath *XPathFilter `json:"matchesJsonPath,omitempty" bson:"matchesJsonPath,omitempty"` EqualToXml *string `json:"equalToXml,omitempty" bson:"equalToXml,omitempty"` MatchesXPath *XPathFilter `json:"matchesXPath,omitempty" bson:"matchesXPath,omitempty"` Includes []MultiFilter `json:"includes,omitempty" bson:"includes,omitempty"` HasExactly []MultiFilter `json:"hasExactly,omitempty" bson:"hasExactly,omitempty"` }
type MatchesBaseXPathRule ¶ added in v1.0.0
type MatchesBaseXPathRule struct {
// contains filtered or unexported fields
}
type MatchesJsonXPathRule ¶ added in v1.0.0
type MatchesJsonXPathRule struct {
MatchesBaseXPathRule
}
type MatchesXmlXPathRule ¶ added in v1.0.0
type MatchesXmlXPathRule struct {
MatchesBaseXPathRule
}
type MockData ¶
type MockData struct { Request *MockRequest `json:"request" bson:"request"` Response *struct { Status *int `json:"status,omitempty" bson:"status,omitempty"` Body *string `json:"body,omitempty" bson:"body,omitempty"` BodyFileName *string `json:"bodyFileName,omitempty" bson:"bodyFileName,omitempty"` JsonBody *interface{} `json:"jsonBody,omitempty" bson:"jsonBody,omitempty"` Headers map[string]string `json:"headers,omitempty" bson:"headers,omitempty"` Cookies map[string]string `json:"cookies,omitempty" bson:"cookies,omitempty"` } `json:"response" bson:"response"` Vars *map[string]string `json:"vars,omitempty" bson:"vars,omitempty"` }
type MockRequest ¶
type MockRequest struct { UrlPath *string `json:"urlPath,omitempty" bson:"urlPath,omitempty"` UrlPattern *string `json:"urlPattern,omitempty" bson:"urlPattern,omitempty"` Method *string `json:"method,omitempty" bson:"method,omitempty"` Headers map[string]Filter `json:"headers,omitempty" bson:"headers,omitempty"` QueryParameters map[string]Filter `json:"queryParameters,omitempty" bson:"queryParameters,omitempty"` FormParameters map[string]Filter `json:"formParameters,omitempty" bson:"formParameters,omitempty"` Cookies map[string]Filter `json:"cookies,omitempty" bson:"cookies,omitempty"` BodyPatterns []Filter `json:"bodyPatterns,omitempty" bson:"bodyPatterns,omitempty"` MultipartPatterns []MultipartPatternsData `json:"multipartPatterns,omitempty" bson:"multipartPatterns,omitempty"` BasicAuthCredentials *struct { Username *string `json:"username,omitempty" bson:"username,omitempty"` Password *string `json:"password,omitempty" bson:"password,omitempty"` } `json:"basicAuthCredentials,omitempty" bson:"basicAuthCredentials,omitempty"` }
type MultiDataCondition ¶ added in v1.0.0
type MultiDataCondition struct {
// contains filtered or unexported fields
}
func (MultiDataCondition) Check ¶ added in v1.0.0
func (c MultiDataCondition) Check() (bool, error)
type MultiFilter ¶ added in v1.0.0
type MultiFilter struct { EqualTo *string `json:"equalTo,omitempty" bson:"equalTo,omitempty"` Contains *string `json:"contains,omitempty" bson:"contains,omitempty"` DoesNotContain *string `json:"doesNotContain,omitempty" bson:"doesNotContain,omitempty"` CaseInsensitive *bool `json:"caseInsensitive,omitempty" bson:"caseInsensitive,omitempty"` }
type MultipartPatternsData ¶ added in v1.0.0
type MultipartPatternsData struct { MatchingType *string `json:"matchingType,omitempty" bson:"matchingType,omitempty"` FileName *Filter `json:"fileName,omitempty" bson:"fileName,omitempty"` Headers map[string]Filter `json:"headers,omitempty" bson:"headers,omitempty"` BodyPatterns []Filter `json:"bodyPatterns,omitempty" bson:"bodyPatterns,omitempty"` }
type OrCondition ¶
type OrCondition struct {
// contains filtered or unexported fields
}
func (OrCondition) Check ¶ added in v0.6.8
func (c OrCondition) Check() (bool, error)
type ParsedConditions ¶ added in v1.0.0
func ParseCondition ¶ added in v0.6.6
func ParseCondition(request *MockRequest, context *DataContext) (*ParsedConditions, error)
type ParsedRules ¶ added in v1.0.0
type ParsedRules struct {
// contains filtered or unexported fields
}
type RequestData ¶ added in v1.2.0
type RequestData map[string]interface{}
func LoadRequestData ¶ added in v1.2.0
func LoadRequestData(req *http.Request) (*RequestData, error)
type WildcardsRule ¶
type WildcardsRule struct {
// contains filtered or unexported fields
}
type XPathFactory ¶ added in v1.0.0
type XPathFactory interface {
// contains filtered or unexported methods
}
type XPathFilter ¶ added in v0.6.2
type XPathFilter struct { Expression string `json:"-" bson:"-"` EqualTo *string `json:"equalTo,omitempty" bson:"equalTo,omitempty"` EqualToJson *string `json:"equalToJson,omitempty" bson:"equalToJson,omitempty"` EqualToXml *string `json:"equalToXml,omitempty" bson:"equalToXml,omitempty"` Contains *string `json:"contains,omitempty" bson:"contains,omitempty"` CaseInsensitive *bool `json:"caseInsensitive,omitempty" bson:"caseInsensitive,omitempty"` IgnoreArrayOrder *bool `json:"ignoreArrayOrder,omitempty" bson:"ignoreArrayOrder,omitempty"` IgnoreExtraElements *bool `json:"ignoreExtraElements,omitempty" bson:"ignoreExtraElements,omitempty"` And []XPathFilter `json:"and,omitempty" bson:"and,omitempty"` Before *time.Time `json:"before,omitempty" bson:"before,omitempty"` // "2021-05-01T00:00:00Z" After *time.Time `json:"after,omitempty" bson:"after,omitempty"` // "2021-05-01T00:00:00Z" EqualToDateTime *time.Time `json:"equalToDateTime,omitempty" bson:"equalToDateTime,omitempty"` ActualFormat *string `json:"actualFormat,omitempty" bson:"actualFormat,omitempty"` XPathNamespaces map[string]string `json:"xPathNamespaces,omitempty" bson:"xPathNamespaces,omitempty"` }
func (*XPathFilter) UnmarshalBSON ¶ added in v0.6.4
func (xPathFilter *XPathFilter) UnmarshalBSON(data []byte) error
func (*XPathFilter) UnmarshalJSON ¶ added in v0.6.2
func (xPathFilter *XPathFilter) UnmarshalJSON(data []byte) error
type XPathFilterProps ¶ added in v1.0.0
type XPathFilterProps struct {
// contains filtered or unexported fields
}
type XPathJsonFactory ¶ added in v1.0.0
type XPathJsonFactory struct{}
type XPathXmlFactory ¶ added in v1.0.0
type XPathXmlFactory struct{}
Click to show internal directories.
Click to hide internal directories.