request-spy

0.0.10 • Public • Published

request spy

logo

Spy on outgoing requests in node. Reports errors, host, path, method, statusCode and request time. Useful for logging, metrics, debugging etc.

npm install request-spy

Usage

const requestSpy = require('request-spy');
 
// Spy on all outgoing request
requestSpy.spy((error, requestData) => {
  console.log(error); // Socket errors
  console.log(requestData);
});
 
 
// Restore
requestSpy.restore();
 

requestData includes the following properties:

  • hostname
  • path
  • method
  • statusCode (not set if network/socket errors occur)
  • requestTime

MIT License © 2017 Daniel Lundin (http://twitter.com/danielundin).

Readme

Keywords

none

Package Sidebar

Install

npm i request-spy

Weekly Downloads

36,633

Version

0.0.10

License

MIT

Unpacked Size

30.8 kB

Total Files

9

Last publish

Collaborators

  • daniel-lundin