JSPM

http-debug

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1355
  • Score
    100M100P100Q102938F
  • License MIT

Simple http(s) request debugger.

Package Exports

  • http-debug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-debug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

http-debug

Build Status   Dependancy Status   NPM Version

npm install http-debug

Usage:

var http = require('http-debug').http;
// var https = require('http-debug').https;

http.debug = 2;

/****
 * debug states
 * - 0     : off     (default state)
 * - 1     : on      (show request, write, end)
 * - 2     : verbose (on + error and socket event reporting)
 *
 * Also support `process.env.HTTP_DEBUG` at load time, which
 * will overide default state, however, anything passed via
 * `http.debug` at run time will cancel out
 * `process.env.HTTP_DEBUG`.
 ****/

// Make http requests as usual.
http.get('http://mervine.net/', function (err, res) {
   if (err) console.trace(err);
   console.log(res.statusCode);
});

Sample Output:

# on stderr

HTTP REQUEST:
{ ... http request data ... }
HTTP REQUEST: END CALLED
{ ... request end data if any ... }
HTTP REQUEST: SOCKET EVENT
{ ... request socket event data ... }

Development

Please contribute. I built this quickly for my own needs.

git clone https://github.com/jmervine/node-http-debug.git
cd node-http-debug
npm install
npm test

No pull requests will be accepted unless tests are (added if need be and) passing.

Change Log

0.1.1

  • Support for process.env.HTTP_DEBUG.
  • https test.

0.1.0

  • Initial release.