ericclemmons/node-recorder

Set username from HTTP headers?

ericclemmons opened this issue · 2 comments

fetch("/api", {
  headers: {
    'X-Fixture-Name': 'me'
  }
})

This would let us save the file dynamically, rather than relying on recorder.user to be set.

I would need to see if this changes things significantly, since every fixture would need to be loaded and headers would not be a differentiator.

Instead, it may be better to use filename or fixturePath or hash to do this.

It needs to be bi-directional:

  • When recording, we need to know where to record file file, for ease of use.
  • When replaying, nock needs to know the difference between asdf.default.json and asdf.someuser.js, and they need to have different headers or something for nock to differentiate (since we need to load all mocks).

Solved in #11