Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions source/api/commands/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cy.route('/users/**')

**{% fa fa-angle-right %} url** ***(String, Glob, RegExp)***

Set a route matching the specific URL.
Listen for a route matching the specific URL.

**{% fa fa-angle-right %} response** ***(String, Object, Array)***

Expand Down Expand Up @@ -153,11 +153,16 @@ If you pass a `response` to `cy.route()`, Cypress will stub the response in the

### `url` as a string

When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written.
When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written. You'll want to use the decoded string and not include any hash encoding (ie. use `@` instead of `%40`).

```javascript
cy.server()
cy.route('https://localhost:7777/users', [{ id: 1, name: 'Pat' }])
cy.route('https://localhost:7777/surveys/[email protected]', [
{
id: 1,
name: 'john'
}
])
```

### `url` as a RegExp
Expand Down
11 changes: 8 additions & 3 deletions source/ja/api/commands/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cy.route('/users/**')

**{% fa fa-angle-right %} url** ***(String, Glob, RegExp)***

Set a route matching the specific `url`.
Listen for a route matching the specific URL.

**{% fa fa-angle-right %} response** ***(String, Object, Array)***

Expand Down Expand Up @@ -153,11 +153,16 @@ If you pass a `response` to `cy.route()`, Cypress will stub the response in the

### `url` as a string

When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written.
When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written. You'll want to use the decoded string and not include any hash encoding (ie. use `@` instead of `%40`).

```javascript
cy.server()
cy.route('https://localhost:7777/users', [{ id: 1, name: 'Pat' }])
cy.route('https://localhost:7777/surveys/[email protected]', [
{
id: 1,
name: 'john'
}
])
```

### `url` as a RegExp
Expand Down
13 changes: 9 additions & 4 deletions source/zh-cn/api/commands/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cy.route('/users/**')

**{% fa fa-angle-right %} url** ***(String, Glob, RegExp)***

Set a route matching the specific `url`.
Listen for a route matching the specific URL.

**{% fa fa-angle-right %} response** ***(String, Object, Array)***

Expand Down Expand Up @@ -153,11 +153,16 @@ If you pass a `response` to `cy.route()`, Cypress will stub the response in the

### `url` as a string

When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written.
When passing a `string` as the `url`, the XHR's URL must match *exactly* what you've written. You'll want to use the decoded string and not include any hash encoding (ie. use `@` instead of `%40`).

```javascript
cy.server()
cy.route('https://localhost:7777/users', [{ id: 1, name: 'Pat' }])
cy.route('https://localhost:7777/surveys/[email protected]', [
{
id: 1,
name: 'john'
}
])
```

### `url` as a RegExp
Expand Down Expand Up @@ -499,4 +504,4 @@ When clicking on `XHR Stub` within the Command Log, the console outputs the foll
- {% url `cy.server()` server %}
- {% url `cy.wait()` wait %}
- {% url 'Guide: Network Requests' network-requests %}
- {% url 'Recipe: Logging in - XHR Web Form' recipes#Logging-In %}
- {% url 'Recipe: Logging in - XHR Web Forms' recipes#Logging-In %}