npm.io
0.4.2 • Published 10 years ago

ys-vcr

Licence
MIT
Version
0.4.2
Deps
2
Vulns
6
Weekly
0

VCR Build Status

Use json based cassettes to playback http queries.

Usage

vcr = require('vcr')
...
vcr.playback()
vcr.play('jurassic_park.vhs')
vcr.stop()

vcr.playback()

This will block all connections with nock

vcr.play()

This will mock connections to a certain endpoint

vcr.stop()

This will reallow connections

VHS format

module.exports.cassettes = {
  'imdb rating post': {
    'host': 'https://api.imdb.com',
    'path': '/',
    'method': 'post',
    'body': { 'jurassicPark': { 'rating': '💕'}},
    'code': 200
  }
}