mappersmith-recorder
EXPERIMENTAL: This module is in a very early stage and intended to be used in a very specific context. It may or may not be appropriate for your use case. For something more mature and generic, take a look at PollyJS.
Mappersmith middleware to record requests and responses as HAR files. These files are simple JSON files that can either be read directly or loaded into a HAR viewer or even the browser's own developer tools.
Note that this middleware currently only works in NodeJS, as it relies on being able to write files to the filesystem. You can implement a custom persistence class that works in a browser environment, but it does not come out of the box.
Installation
$ yarn add mappersmith-recorder
Usage
const path = const forge = ;const RecorderMiddleware Session FileSystemPersistence = ; const persistence = path: path const session = name: 'github' persistence const client = ; const main = async { await clientStatuscurrent // Save the session to disk await session await clientStatuscurrent // Save session containing both calls await session // Clear the session session}
After running the following, in recordings/
there should be two files called github-${datetime}.har
.