Record/Replay Upstream Requests

During development, you may have to interact with APIs or other endpoints that are slow enough to delay development.

To mitigate this, Moov PWA has an integrated record/replay feature for upstream requests. When this feature is enabled, recorded responses will be returned immediately, while the upstream request continues in the background to update the recorded response. This way, development doesn't need to be slowed by long request times.

Recording Requests

By default, Moov PWA records outgoing requests to a local DB. If your requests are sensitive and should not be recorded, run yarn start with the --no-record-upstream-requests flag.

Replaying Requests

By default, Moov PWA does not replay previously recorded outgoing requests. If replay is desired, run yarn start with the --replay-upstream-requests flag.

When replaying requests, the following occurs upon an outgoing request being made:

  1. The local recording DB is checked for the outgoing request.
  2. The upstream request is issued.
  3. The recorded response is returned (if found in the recording DB).
  4. If the upstream request is successful, the response is added to the recording DB, or the old response is overwritten if the request was already recorded.

Recording DB Size

By default, the recording DB will keep at most 200 requests recorded, and then remove the least recently used requests to maintain that size. If you desire a different limit, add the --max-recorded-requests=N flag where N is the desired limit.