{"_id":"request-debug","_rev":"232146","name":"request-debug","description":"Library to assist with debugging HTTP(s) requests made by the request module.","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"time":{"modified":"2021-06-03T15:47:00.000Z","created":"2014-08-29T03:42:11.091Z","0.2.0":"2015-05-20T17:57:17.448Z","0.1.1":"2014-10-26T21:03:19.718Z","0.1.0":"2014-10-20T04:02:03.979Z","0.0.3":"2014-09-15T14:58:36.844Z","0.0.2":"2014-09-14T20:34:07.773Z","0.0.1":"2014-08-29T03:42:11.091Z"},"users":{"cguillemette":true,"wangnan0610":true,"gurunate":true,"vchouhan":true},"author":{"name":"James Nylen","email":"jnylen@gmail.com"},"repository":{"type":"git","url":"https://github.com/request/request-debug"},"versions":{"0.2.0":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.2.0","repository":{"type":"git","url":"https://github.com/request/request-debug"},"bugs":{"url":"https://github.com/request/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"detect-engine":"~1.0.2","express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.50.0","should":"~4.0.4"},"dependencies":{"stringify-clone":"^1.0.0"},"gitHead":"afd2d830582ee6d86a7d14b3490e0a2eb80068da","homepage":"https://github.com/request/request-debug","_id":"request-debug@0.2.0","_shasum":"fc054ec817181b04ca41a052c136f61c48abaf78","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"fc054ec817181b04ca41a052c136f61c48abaf78","size":8433,"noattachment":false,"key":"/request-debug/-/request-debug-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.2.0.tgz"},"directories":{},"publish_time":1432144637448,"_cnpm_publish_time":1432144637448,"_hasShrinkwrap":false},"0.1.1":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.1.1","repository":{"type":"git","url":"https://github.com/request/request-debug"},"bugs":{"url":"https://github.com/request/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.40.0","should":"~4.0.4"},"dependencies":{"clone":"~0.1.18"},"gitHead":"e0df2334946e4deef541a8e39d4158a4c3c5f023","homepage":"https://github.com/request/request-debug","_id":"request-debug@0.1.1","_shasum":"95b1c763c9752a90ebd887285c5c6911d05d27d8","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"nylen","email":"jnylen@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"95b1c763c9752a90ebd887285c5c6911d05d27d8","size":8386,"noattachment":false,"key":"/request-debug/-/request-debug-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.1.1.tgz"},"directories":{},"publish_time":1414357399718,"_cnpm_publish_time":1414357399718,"_hasShrinkwrap":false},"0.1.0":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.1.0","repository":{"type":"git","url":"https://github.com/nylen/request-debug"},"bugs":{"url":"https://github.com/nylen/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.40.0","should":"~4.0.4"},"dependencies":{"clone":"~0.1.18"},"gitHead":"052bec744c1b117ed55c56c83fc83e996744b93d","homepage":"https://github.com/nylen/request-debug","_id":"request-debug@0.1.0","_shasum":"6e228d6f9fa4a554ef162f885e761e29b11dd86f","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"nylen","email":"jnylen@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"6e228d6f9fa4a554ef162f885e761e29b11dd86f","size":8383,"noattachment":false,"key":"/request-debug/-/request-debug-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.1.0.tgz"},"directories":{},"publish_time":1413777723979,"_cnpm_publish_time":1413777723979,"_hasShrinkwrap":false},"0.0.3":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.0.3","repository":{"type":"git","url":"https://github.com/nylen/request-debug"},"bugs":{"url":"https://github.com/nylen/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.40.0","should":"~4.0.4"},"dependencies":{"clone":"~0.1.18"},"gitHead":"a5bb307e70dd756b8ae12287aa54cd9bea486948","homepage":"https://github.com/nylen/request-debug","_id":"request-debug@0.0.3","_shasum":"7bd16e57d3e5aea114759d56e06d3f51ef68e850","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"nylen","email":"jnylen@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"7bd16e57d3e5aea114759d56e06d3f51ef68e850","size":8174,"noattachment":false,"key":"/request-debug/-/request-debug-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.0.3.tgz"},"directories":{},"publish_time":1410793116844,"_cnpm_publish_time":1410793116844,"_hasShrinkwrap":false},"0.0.2":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.0.2","repository":{"type":"git","url":"https://github.com/nylen/request-debug"},"bugs":{"url":"https://github.com/nylen/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.40.0","should":"~4.0.4"},"dependencies":{"clone":"~0.1.18"},"gitHead":"bd2093d85ea196a0172ad5eca48f728328628d06","homepage":"https://github.com/nylen/request-debug","_id":"request-debug@0.0.2","_shasum":"be7607810342399a89952b021e2523afbc2a7b84","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"nylen","email":"jnylen@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"be7607810342399a89952b021e2523afbc2a7b84","size":8022,"noattachment":false,"key":"/request-debug/-/request-debug-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.0.2.tgz"},"directories":{},"publish_time":1410726847773,"_cnpm_publish_time":1410726847773,"_hasShrinkwrap":false},"0.0.1":{"name":"request-debug","author":{"name":"James Nylen","email":"jnylen@gmail.com"},"description":"Library to assist with debugging HTTP(s) requests made by the request module.","version":"0.0.1","repository":{"type":"git","url":"https://github.com/nylen/request-debug"},"bugs":{"url":"https://github.com/nylen/request-debug/issues"},"license":"MIT","keywords":["request","debug","http","https","headers"],"scripts":{"test":"node node_modules/.bin/mocha"},"main":"index.js","devDependencies":{"express":"~4.8.6","mocha":"~1.21.4","passport":"~0.2.0","passport-http":"~0.2.2","request":"~2.40.0","should":"~4.0.4"},"dependencies":{"clone":"~0.1.18"},"gitHead":"730e8a268fd70ef7f6bdc5575d3f584697ab1ea4","homepage":"https://github.com/nylen/request-debug","_id":"request-debug@0.0.1","_shasum":"755a6db5e85440f25ee6dbf282cf89fdb1236b52","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"nylen","email":"jnylen@gmail.com"},"maintainers":[{"name":"nylen","email":""},{"name":"simov","email":""}],"dist":{"shasum":"755a6db5e85440f25ee6dbf282cf89fdb1236b52","size":7978,"noattachment":false,"key":"/request-debug/-/request-debug-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/request-debug/download/request-debug-0.0.1.tgz"},"directories":{},"publish_time":1409283731091,"_cnpm_publish_time":1409283731091,"_hasShrinkwrap":false}},"readme":"# request-debug [![Build status](https://img.shields.io/travis/request/request-debug.svg?style=flat)](https://travis-ci.org/request/request-debug) [![npm package](http://img.shields.io/npm/v/request-debug.svg?style=flat)](https://www.npmjs.org/package/request-debug)\n\nThis Node.js module provides an easy way to monitor HTTP(S) requests performed\nby the [`request` module](https://github.com/request/request), and their\nresponses from external servers.\n\n## Usage\n\nBasic usage is to require the module and call it, passing in the object\nreturned by `require('request')`:\n\n```js\nvar request = require('request');\n\nrequire('request-debug')(request);\n```\n\nThis will set up event handlers on every request performed with the `request`\nvariable from this point.\n\nYou can also specify a function to handle request or response data:\n\n```js\nrequire('request-debug')(request, function(type, data, r) {\n    // put your request or response handling logic here\n});\n```\n\nIf you specify your own handling function, `r` will be the `Request` instance\nthat generated the event, and `type` will be one of the following values:\n\n- **request** - Headers were sent to the server and will be included as\n  `data.headers`.  `data.body` may also be present for POST requests.\n\n- **response** - Headers were received from the server and will be included as\n  `data.headers`.  Note that `request` only buffers the response body if a\n  callback was given, so it will only be available as `data.body` if the\n  initial call to `request` included a callback.\n\n- **redirect** - A redirect status code (*HTTP 3xx*) was received.  The `data`\n  object will have properties `statusCode`, `headers`, and `uri` (the address\n  of the next request).\n\n- **auth** - A *HTTP 401 Unathorized* response was received.  Internally,\n  `request` handles this like a redirect, so the same properties will be\n  available on the `data` object.\n\nYou can use the `data.debugId` parameter to match up requests with their\nresponses and other events.\n\nThe default handling function writes the data to *stderr* in Node's JSON-like\nobject display format.  See the example below for more details.\n\nTo disable debugging, call `request.stopDebugging()` (this function only exists\nif debugging has already been enabled).  Any requests that are in progress when\n`stopDebugging()` is called will still generate debug events.\n\n## Example\n\n```js\nvar request = require('request');\n\nrequire('request-debug')(request);\n\n// digest.php is example 2 from:\n// http://php.net/manual/en/features.http-auth.php\n\nrequest({\n    uri  : 'http://nylen.tv/digest.php',\n    auth : {\n        user : 'admin',\n        pass : 'mypass',\n        sendImmediately : false\n    },\n    rejectUnauthorized : false,\n}, function(err, res, body) {\n    console.log('REQUEST RESULTS:', err, res.statusCode, body);\n});\n```\n\nUnless you provide your own function as the second parameter to the\n`request-debug` call, this will produce console output similar to the\nfollowing:\n\n```js\n{ request:\n   { debugId: 1,\n     uri: 'http://nylen.tv/digest.php',\n     method: 'GET',\n     headers: { host: 'nylen.tv' } } }\n{ auth:\n   { debugId: 1,\n     statusCode: 401,\n     headers:\n      { date: 'Mon, 20 Oct 2014 03:34:58 GMT',\n        server: 'Apache/2.4.6 (Debian)',\n        'x-powered-by': 'PHP/5.5.6-1',\n        'www-authenticate': 'Digest realm=\"Restricted area\",qop=\"auth\",nonce=\"544482e2556d9\",opaque=\"cdce8a5c95a1427d74df7acbf41c9ce0\"',\n        'content-length': '39',\n        'keep-alive': 'timeout=5, max=100',\n        connection: 'Keep-Alive',\n        'content-type': 'text/html' },\n     uri: 'http://nylen.tv/digest.php' } }\n{ request:\n   { debugId: 1,\n     uri: 'http://nylen.tv/digest.php',\n     method: 'GET',\n     headers:\n      { authorization: 'Digest username=\"admin\", realm=\"Restricted area\", nonce=\"544482e2556d9\", uri=\"/digest.php\", qop=auth, response=\"e833c7fa52e8d42fae3ca784b96dfd38\", nc=00000001, cnonce=\"ab6ff3dd95a0449e990a6c8465a6bb26\", opaque=\"cdce8a5c95a1427d74df7acbf41c9ce0\"',\n        host: 'nylen.tv' } } }\n{ response:\n   { debugId: 1,\n     headers:\n      { date: 'Mon, 20 Oct 2014 03:34:58 GMT',\n        server: 'Apache/2.4.6 (Debian)',\n        'x-powered-by': 'PHP/5.5.6-1',\n        'content-length': '27',\n        'keep-alive': 'timeout=5, max=100',\n        connection: 'Keep-Alive',\n        'content-type': 'text/html' },\n     statusCode: 200,\n     body: 'You are logged in as: admin' } }\nREQUEST RESULTS: null 200 You are logged in as: admin\n```\n\n## Compatibility\n\nTested with Node.js versions 0.8.x, 0.10.x, and 0.11.x on Travis, and a bunch\nof different `request` versions.\n\nDoes not work with `request` versions older than 2.22.0 (July 2013).  Tests\ndon't start passing until version 2.28.0 (December 2013).\n","_attachments":{},"homepage":"https://github.com/request/request-debug","bugs":{"url":"https://github.com/request/request-debug/issues"},"license":"MIT"}