Open 40x opened 3 years ago
Your config looks right to me. Do you have a header or something in the url that's constantly changing (e.g. a date, time stamp, or uuid) on every recording? If so, you'll need to ignore it by providing additional config options via matchRequestsBy
.
No, I don't, I'll try to break down my use case and I'd love to know if it's even possible to do it or not.
Expected the API calls to be replayed but they didn't. When I stop our proxy server (SIGINT) I see a few har file with those API calls. I understand what it is doing and why (I'm assuming it's cause I have an fs persister which reads/writes to HAR).
Not sure where to go from here.
I have a similar requirement.
Looked at the source code.
Apparently we can call await polly.persister?.persist();
to persist before stopping the server.
https://github.com/Netflix/pollyjs/blob/9b6bede12b7ee998472b8883c9dd01e2159e00a8/packages/%40pollyjs/core/src/polly.js#L252
Hope it helps.
Description
Is it possible to record and replay at the same time? I have a node proxy server for a web app in which I am trying to request the resources only once and then server them from the recorded cache.
Config
This is the config that I have so far, it seems to be recording (I can see it on the logs) but not replaying (keeps recording instead). Should I be using a different kind of persister instead?
Dependencies
Environment
Node.js v14.16.0 darwin 19.6.0 npm 6.14.11