-
-
Save alekpopovic/e3e3b168845982a83af4b7a228d18161 to your computer and use it in GitHub Desktop.
Record nocks to a json file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var nock = require('nock'); | |
| var low = require('lowdb'); | |
| // lowdb is a great straight-to-json minidb. | |
| var db = low('integration_test_nock_records.json'); | |
| writeToFileLog = function(object) { | |
| console.log("writing nock to json...."); | |
| db('records').push(object); | |
| } | |
| nock.recorder.rec({ | |
| output_objects: true, // we want object representations | |
| logging: writeToFileLog, // use our custom func instead of `console.log` | |
| use_separator: false, // no `<<<<<< cut here >>>>>` string appended to output | |
| enable_reqheaders_recording: true, // see what request headers we sent | |
| }); | |
| // Kick off your http requests here! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment