request-spy is a Node.js utility designed to intercept and report on all outgoing HTTP/HTTPS requests made within a Node.js application. It operates by patching Node.js's internal request mechanisms, allowing users to log errors, monitor hostnames, paths, methods, HTTP status codes, and the request duration. The package is currently at version 0.0.10. Given its last known update around 2017 (indicated by the README copyright), it appears to be either in a long-term maintenance state or, more likely, abandoned, suggesting an infrequent or non-existent release cadence. Its primary differentiator is its simple, global interception mechanism, which can be useful for debugging or basic metrics collection without modifying individual request calls. However, its age may present significant compatibility challenges with newer Node.js runtime versions, especially concerning modern module systems like ESM or the `fetch` API.
npm install request-spyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `request-spy` to intercept all outgoing HTTP requests, log their details, and then restore the original Node.js behavior after a short period. It includes an example HTTP request to an external API to trigger the spy.
Consider using modern alternatives like `nock` (for mocking) or `axios-debug-log` / custom interceptors for libraries like `axios` or `node-fetch` if you need request logging or interception. For general observability, integrate with APM tools.
Always use `const requestSpy = require('request-spy');` when importing this package in a CommonJS context. If your project is ESM, you might need to use `createRequire` from the `module` module or consider a different library.Verify that your application's outgoing requests are indeed using the `http` or `https` modules. For broader interception, a proxy-based solution or dedicated APM/observability tools might be more effective.
Avoid using `request-spy` alongside other global patching libraries. Test thoroughly in your environment. If conflicts arise, consider isolating the spying functionality to specific parts of your application or using less intrusive methods.
Ensure you are using `const requestSpy = require('request-spy');` and then calling `requestSpy.spy(...)` or `requestSpy.restore()`.Run `npm install request-spy` to ensure the package is installed. If using ESM, confirm that `createRequire` or similar compatibility layers are correctly configured, or revert to CommonJS.
This warning indicates potential future breakage. The fix would involve updating or replacing `request-spy` with a more current alternative compatible with your Node.js version, as `request-spy` itself is no longer maintained.
No dependency data recorded yet.