LinkedInAttic / sepia

Sepia is a VCR-like module for node.js that records HTTP interactions, then plays them back exactly like the first time they were invoked
Apache License 2.0
279 stars 32 forks source link

Add substitute capability #20

Closed aneilbaboo closed 7 years ago

aneilbaboo commented 7 years ago

Hi @avik-das - I added the substitution capability suggested in #13.

Now you can do:

var sepia = require('sepia');

sepia.substitute('<MYSECRET>', function () { return process.env.MY_ACCESS_TOKEN; });

And the fixtures will contain , while the requests will contain the value of MY_ACCESS_TOKEN.

I added tests, but couldn't quite figure out how to test the fixture files themselves. I did check that they look right, though.

aneilbaboo commented 7 years ago

Closed in favor of #22, which moves this PR to a different branch.