add context.inspect(), cleanup app.inspect()

closes #323 closes #250
This commit is contained in:
Jonathan Ong 2014-08-02 04:10:07 -07:00
parent e7f74f9bbb
commit 1605f33760
2 changed files with 20 additions and 1 deletions

View file

@ -72,11 +72,13 @@ app.listen = function(){
/**
* Return JSON representation.
* We only bother showing settings.
*
* @return {Object}
* @api public
*/
app.inspect =
app.toJSON = function(){
return only(this, [
'subdomainOffset',

View file

@ -13,6 +13,18 @@ var http = require('http');
var proto = module.exports = {
/**
* util.inspect() implementation, which
* just returns the JSON output.
*
* @return {Object}
* @api public
*/
inspect: function(){
return this.toJSON();
},
/**
* Return JSON representation.
*
@ -28,7 +40,12 @@ var proto = module.exports = {
toJSON: function(){
return {
request: this.request.toJSON(),
response: this.response.toJSON()
response: this.response.toJSON(),
app: this.app.toJSON(),
originalUrl: this.originalUrl,
req: '<original node req>',
res: '<original node res>',
socket: '<original node socket>',
}
},