Nock-cheatsheets速查表

Nock

scope = nock('http://foo.com')
scope = nock('http://foo.com', { allowUnmocked: true })
nock('http://foo.com')
  .get('/user')
  .reply(200, { id: 1234 })

Filtering

nock('http://foo.com')
  .filteringPath(/[&\?]token=[^&]*/g, '')
  .get('/user')

// catches "/user?token=..." as well

本站为非盈利网站,作品由网友提供上传,如无意中有侵犯您的版权,请联系删除