Set username from HTTP headers?
ericclemmons opened this issue · 2 comments
ericclemmons commented
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.
ericclemmons commented
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 betweenasdf.default.json
andasdf.someuser.js
, and they need to have different headers or something fornock
to differentiate (since we need to load all mocks).
ericclemmons commented
Solved in #11