Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Display example of how to use variables in regex
  • Loading branch information
jonasps committed Nov 30, 2018
1 parent 8681af9 commit 850b225
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -126,6 +126,14 @@ mock.onGet(/\/users\/\d+/).reply(function(config) {
return [200, {}];
});
```
Using variables in regex
```js
const usersUri = '/users';
const url = new RegExp(`${usersUri}/*`);

mock.onGet(url).reply(200, users);
```


Specify no path to match by verb alone

Expand Down

0 comments on commit 850b225

Please sign in to comment.