You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,41 @@ final class LoginUITests: XCTestCase {
143
143
}
144
144
```
145
145
146
+
### Request patterns
147
+
148
+
You can specify a pattern for catch http requests and make a response with mock data. Pattern matching applied for URL and http headers in the request. See `RequestPattern` struct.
149
+
150
+
Three types of patterns can be used:
151
+
152
+
-`equal` - the request value must be exactly the same as the pattern value,
153
+
-`wildcard` - the request value match with the wildcard pattern (see below),
154
+
-`regexp` - the request value match with the regular expression pattern.
155
+
156
+
##### Note:
157
+
If you want to apply a wildcard pattern for the url query parameters, don't forget escape `?` symbol after domain or path.
158
+
159
+
```swift
160
+
Pattern.wildcard("http://example.com\?query=*")
161
+
```
162
+
163
+
### Wildcard pattern
164
+
165
+
"Wildcards" are the patterns you type when you do stuff like `ls *.js` on the command line, or put `build/*` in a `.gitignore` file.
166
+
167
+
In our implementation any wildcard pattern translates to regular expression and applies matching with URL or header string.
168
+
169
+
The following characters have special magic meaning when used in a pattern:
170
+
171
+
-`*` matches 0 or more characters in a single path portion
172
+
-`?` matches 1 character
173
+
-`[a-z]` matches a range of characters, similar to a RegExp range.
174
+
-`{bar,baz}` matches one of the substitution listed in braces. For example pattern `foo{bar,baz}` matches strings `foobar` or `foobaz`
175
+
176
+
You can escape special characters with backslash `\`.
0 commit comments