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: source/api/commands/server.md
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ Option | Default | Description
57
57
`onAnyRequest` | `undefined` | callback function called when any request is sent
58
58
`onAnyResponse` | `undefined` | callback function called when any response is returned
59
59
`urlMatchingOptions` | `{ matchBase: true }` | The default options passed to `minimatch` when using glob strings to match URLs
60
-
`whitelist` | function | Callback function that filters requests from ever being logged or stubbed. By default this matches against asset-like requests such as for `.js`, `.jsx`, `.html`, and `.css` files.
60
+
`ignore` | function | Callback function that filters requests from ever being logged or stubbed. By default this matches against asset-like requests such as for `.js`, `.jsx`, `.html`, and `.css` files.
61
61
62
62
## Yields {% helper_icon yields %}
63
63
@@ -70,7 +70,7 @@ Option | Default | Description
70
70
### After starting a server:
71
71
72
72
- Any request that does **NOT** match a {% url `cy.route()` route %} will {% url 'pass through to the server' network-requests#Don’t-Stub-Responses %}.
73
-
- Any request that matches the `options.whitelist` function will **NOT** be logged or stubbed. In other words it is filtered and ignored.
73
+
- Any request that matches the `options.ignore` function will **NOT** be logged or stubbed.
74
74
- You will see requests named as `(XHR Stub)` or `(XHR)` in the Command Log.
75
75
76
76
```javascript
@@ -181,27 +181,27 @@ cy.server({
181
181
182
182
### Change the default filtering
183
183
184
-
`cy.server()` comes with a `whitelist` function that by default filters out any requests that are for static assets like `.html`, `.js`, `.jsx`, and `.css`.
184
+
`cy.server()` comes with an `ignore` function that by default filters out any requests that are for static assets like `.html`, `.js`, `.jsx`, and `.css`.
185
185
186
-
Any request that passes the `whitelist` will be ignored - it will not be logged nor will it be stubbed in any way (even if it matches a specific {% url `cy.route()` route %}).
186
+
Any request that passes the `ignore` will be ignored - it will not be logged nor will it be stubbed in any way (even if it matches a specific {% url `cy.route()` route %}).
187
187
188
188
The idea is that we never want to interfere with static assets that are fetched via Ajax.
189
189
190
190
**The default filter function in Cypress is:**
191
191
192
192
```javascript
193
-
constwhitelist= (xhr) => {
193
+
constignore= (xhr) => {
194
194
// this function receives the xhr object in question and
195
-
// will filter if it's a GET that appears to be a static resource
0 commit comments