-
Notifications
You must be signed in to change notification settings - Fork 19
/
url_matcher.go
66 lines (57 loc) · 1.72 KB
/
url_matcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package wiremock
// URLMatcherInterface is pair URLMatchingStrategy and string matched value
type URLMatcherInterface interface {
Strategy() URLMatchingStrategy
Value() string
}
// URLMatcher is structure for defining the type of url matching.
type URLMatcher struct {
strategy URLMatchingStrategy
value string
}
// Strategy returns URLMatchingStrategy of URLMatcher.
func (m URLMatcher) Strategy() URLMatchingStrategy {
return m.strategy
}
// Value returns value of URLMatcher.
func (m URLMatcher) Value() string {
return m.value
}
// URLEqualTo returns URLMatcher with URLEqualToRule matching strategy.
func URLEqualTo(url string) URLMatcher {
return URLMatcher{
strategy: URLEqualToRule,
value: url,
}
}
// URLPathEqualTo returns URLMatcher with URLPathEqualToRule matching strategy.
func URLPathEqualTo(url string) URLMatcher {
return URLMatcher{
strategy: URLPathEqualToRule,
value: url,
}
}
// URLPathMatching returns URLMatcher with URLPathMatchingRule matching strategy.
func URLPathMatching(url string) URLMatcher {
return URLMatcher{
strategy: URLPathMatchingRule,
value: url,
}
}
// URLMatching returns URLMatcher with URLMatchingRule matching strategy.
func URLMatching(url string) URLMatcher {
return URLMatcher{
strategy: URLMatchingRule,
value: url,
}
}
// URLPathTemplate URL paths can be matched using URI templates, conforming to the same subset of the URI template standard as used in OpenAPI.
// Path variable matchers can also be used in the same manner as query and form parameters.
// Required wiremock >= 3.0.0
// Example: /contacts/{contactId}/addresses/{addressId}
func URLPathTemplate(url string) URLMatcher {
return URLMatcher{
strategy: URLPathTemplateRule,
value: url,
}
}