fix inspection of app. Closes #108

This commit is contained in:
TJ Holowaychuk 2014-03-11 11:06:57 -07:00
parent 895cf4040c
commit 9b1651a8e6
3 changed files with 10 additions and 0 deletions

View file

@ -577,6 +577,7 @@ module.exports = {
*/
inspect: function(){
if (!this.req) return;
return this.toJSON();
},

View file

@ -432,6 +432,7 @@ module.exports = {
*/
inspect: function(){
if (!this.res) return;
var o = this.toJSON();
o.body = this.body;
return o;

View file

@ -61,6 +61,14 @@ describe('app.toJSON()', function(){
})
})
describe('app.inspect()', function(){
it('should work', function(){
var app = koa();
var util = require('util');
var str = util.inspect(app);
})
})
describe('app.use(fn)', function(){
it('should compose middleware', function(done){
var app = koa();