nock: update layout
This commit is contained in:
parent
a45f46935b
commit
c59095af32
10
nock.md
10
nock.md
|
@ -1,22 +1,28 @@
|
||||||
---
|
---
|
||||||
title: Nock
|
title: Nock
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
### Nock
|
### Nock
|
||||||
|
|
||||||
|
```js
|
||||||
scope = nock('http://foo.com')
|
scope = nock('http://foo.com')
|
||||||
scope = nock('http://foo.com', { allowUnmocked: true })
|
scope = nock('http://foo.com', { allowUnmocked: true })
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
nock('http://foo.com')
|
nock('http://foo.com')
|
||||||
.get('/user')
|
.get('/user')
|
||||||
.reply(200, { id: 1234 })
|
.reply(200, { id: 1234 })
|
||||||
|
```
|
||||||
|
|
||||||
### Filtering
|
### Filtering
|
||||||
|
|
||||||
|
```js
|
||||||
nock('http://foo.com')
|
nock('http://foo.com')
|
||||||
.filteringPath(/[&\?]token=[^&]*/g, '')
|
.filteringPath(/[&\?]token=[^&]*/g, '')
|
||||||
.get('/user')
|
.get('/user')
|
||||||
|
|
||||||
# catches "/user?token=..." as well
|
// catches "/user?token=..." as well
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue