nock: update layout

This commit is contained in:
Rico Sta. Cruz 2018-02-20 00:10:17 +08:00
parent a45f46935b
commit c59095af32
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 16 additions and 10 deletions

26
nock.md
View File

@ -1,22 +1,28 @@
--- ---
title: Nock title: Nock
category: JavaScript libraries category: JavaScript libraries
layout: 2017/sheet
--- ---
### Nock ### Nock
scope = nock('http://foo.com') ```js
scope = nock('http://foo.com', { allowUnmocked: true }) scope = nock('http://foo.com')
scope = nock('http://foo.com', { allowUnmocked: true })
nock('http://foo.com') ```
.get('/user')
.reply(200, { id: 1234 })
```js
nock('http://foo.com')
.get('/user')
.reply(200, { id: 1234 })
```
### Filtering ### Filtering
nock('http://foo.com') ```js
.filteringPath(/[&\?]token=[^&]*/g, '') nock('http://foo.com')
.get('/user') .filteringPath(/[&\?]token=[^&]*/g, '')
.get('/user')
# catches "/user?token=..." as well // catches "/user?token=..." as well
```