requestmodule that saves all network traffic data as a HAR file.
request >= 2.81.0 recommended, as it has much more detailed timings via
request >= v2.75.0 required, at a minimum.
// wrap around your request moduleconst RCH = ;const requestCaptureHar = ;// ...// `requestCaptureHar.request` is your `request` module's API.// ...requestCaptureHar;// Save HAR file to diskrequestCaptureHar;// You can also clear any collected trafficrequestCaptureHar;
This repo is a fork of larsthorup's
node-request-har-capture. Instead of monkey-patching
request-promise, the API allows you to pass in the general
request module. We also added better support for transfer timings.
Above is a HAR captured by using
request-capture-har from within
npm to capture an
This is especially useful for capturing all test traffic from your back-end test suite, for doing auto mocking in your front-end test suite. See this project for an example: https://github.com/larsthorup/http-auto-mock-demo. Blog post about this technique: http://www.zealake.com/2015/01/05/unit-test-your-service-integration-layer/