@@ -11,6 +11,7 @@ const (
11
11
ParamMatchesJsonPath ParamMatchingStrategy = "matchesJsonPath"
12
12
ParamAbsent ParamMatchingStrategy = "absent"
13
13
ParamDoesNotMatch ParamMatchingStrategy = "doesNotMatch"
14
+ ParamDoesNotContains ParamMatchingStrategy = "doesNotContain"
14
15
)
15
16
16
17
// Types of url matching.
@@ -27,6 +28,11 @@ const (
27
28
IgnoreExtraElements EqualFlag = "ignoreExtraElements"
28
29
)
29
30
31
+ const (
32
+ ParamHasExactly MultiValueMatchingStrategy = "hasExactly"
33
+ ParamIncludes MultiValueMatchingStrategy = "includes"
34
+ )
35
+
30
36
// EqualFlag is enum of less strict matching flag.
31
37
type EqualFlag string
32
38
@@ -36,163 +42,5 @@ type URLMatchingStrategy string
36
42
// ParamMatchingStrategy is enum params matching type.
37
43
type ParamMatchingStrategy string
38
44
39
- // URLMatcher is structure for defining the type of url matching.
40
- type URLMatcher struct {
41
- strategy URLMatchingStrategy
42
- value string
43
- }
44
-
45
- // Strategy returns URLMatchingStrategy of URLMatcher.
46
- func (m URLMatcher ) Strategy () URLMatchingStrategy {
47
- return m .strategy
48
- }
49
-
50
- // Value returns value of URLMatcher.
51
- func (m URLMatcher ) Value () string {
52
- return m .value
53
- }
54
-
55
- // URLEqualTo returns URLMatcher with URLEqualToRule matching strategy.
56
- func URLEqualTo (url string ) URLMatcher {
57
- return URLMatcher {
58
- strategy : URLEqualToRule ,
59
- value : url ,
60
- }
61
- }
62
-
63
- // URLPathEqualTo returns URLMatcher with URLPathEqualToRule matching strategy.
64
- func URLPathEqualTo (url string ) URLMatcher {
65
- return URLMatcher {
66
- strategy : URLPathEqualToRule ,
67
- value : url ,
68
- }
69
- }
70
-
71
- // URLPathMatching returns URLMatcher with URLPathMatchingRule matching strategy.
72
- func URLPathMatching (url string ) URLMatcher {
73
- return URLMatcher {
74
- strategy : URLPathMatchingRule ,
75
- value : url ,
76
- }
77
- }
78
-
79
- // URLMatching returns URLMatcher with URLMatchingRule matching strategy.
80
- func URLMatching (url string ) URLMatcher {
81
- return URLMatcher {
82
- strategy : URLMatchingRule ,
83
- value : url ,
84
- }
85
- }
86
-
87
- // ParamMatcher is structure for defining the type of params.
88
- type ParamMatcher struct {
89
- strategy ParamMatchingStrategy
90
- value string
91
- flags map [string ]bool
92
- }
93
-
94
- // Strategy returns ParamMatchingStrategy of ParamMatcher.
95
- func (m ParamMatcher ) Strategy () ParamMatchingStrategy {
96
- return m .strategy
97
- }
98
-
99
- // Value returns value of ParamMatcher.
100
- func (m ParamMatcher ) Value () string {
101
- return m .value
102
- }
103
-
104
- // Flags return value of ParamMatcher.
105
- func (m ParamMatcher ) Flags () map [string ]bool {
106
- return m .flags
107
- }
108
-
109
- // EqualTo returns ParamMatcher with ParamEqualTo matching strategy.
110
- func EqualTo (param string ) ParamMatcher {
111
- return ParamMatcher {
112
- strategy : ParamEqualTo ,
113
- value : param ,
114
- }
115
- }
116
-
117
- // EqualToIgnoreCase returns ParamMatcher with ParamEqualToIgnoreCase matching strategy
118
- func EqualToIgnoreCase (param string ) ParamMatcher {
119
- return ParamMatcher {
120
- strategy : ParamEqualTo ,
121
- value : param ,
122
- flags : map [string ]bool {
123
- "caseInsensitive" : true ,
124
- },
125
- }
126
- }
127
-
128
- // Matching returns ParamMatcher with ParamMatches matching strategy.
129
- func Matching (param string ) ParamMatcher {
130
- return ParamMatcher {
131
- strategy : ParamMatches ,
132
- value : param ,
133
- }
134
- }
135
-
136
- // Contains returns ParamMatcher with ParamContains matching strategy.
137
- func Contains (param string ) ParamMatcher {
138
- return ParamMatcher {
139
- strategy : ParamContains ,
140
- value : param ,
141
- }
142
- }
143
-
144
- // EqualToXml returns ParamMatcher with ParamEqualToXml matching strategy.
145
- func EqualToXml (param string ) ParamMatcher {
146
- return ParamMatcher {
147
- strategy : ParamEqualToXml ,
148
- value : param ,
149
- }
150
- }
151
-
152
- // EqualToJson returns ParamMatcher with ParamEqualToJson matching strategy.
153
- func EqualToJson (param string , flags ... EqualFlag ) ParamMatcher {
154
- mflags := make (map [string ]bool , len (flags ))
155
- for _ , flag := range flags {
156
- mflags [string (flag )] = true
157
- }
158
-
159
- return ParamMatcher {
160
- strategy : ParamEqualToJson ,
161
- value : param ,
162
- flags : mflags ,
163
- }
164
- }
165
-
166
- // MatchingXPath returns ParamMatcher with ParamMatchesXPath matching strategy.
167
- func MatchingXPath (param string ) ParamMatcher {
168
- return ParamMatcher {
169
- strategy : ParamMatchesXPath ,
170
- value : param ,
171
- }
172
- }
173
-
174
- // MatchingJsonPath returns ParamMatcher with ParamMatchesJsonPath matching strategy.
175
- func MatchingJsonPath (param string ) ParamMatcher {
176
- return ParamMatcher {
177
- strategy : ParamMatchesJsonPath ,
178
- value : param ,
179
- }
180
- }
181
-
182
- // NotMatching returns ParamMatcher with ParamDoesNotMatch matching strategy.
183
- func NotMatching (param string ) ParamMatcher {
184
- return ParamMatcher {
185
- strategy : ParamDoesNotMatch ,
186
- value : param ,
187
- }
188
- }
189
-
190
- func Absent () ParamMatcher {
191
- return ParamMatcher {
192
- strategy : ParamAbsent ,
193
- value : "" ,
194
- flags : map [string ]bool {
195
- string (ParamAbsent ): true ,
196
- },
197
- }
198
- }
45
+ // MultiValueMatchingStrategy is enum multi value matching type.
46
+ type MultiValueMatchingStrategy string
0 commit comments