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(){ inspect: function(){
if (!this.req) return;
return this.toJSON(); return this.toJSON();
}, },

View file

@ -432,6 +432,7 @@ module.exports = {
*/ */
inspect: function(){ inspect: function(){
if (!this.res) return;
var o = this.toJSON(); var o = this.toJSON();
o.body = this.body; o.body = this.body;
return o; 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(){ describe('app.use(fn)', function(){
it('should compose middleware', function(done){ it('should compose middleware', function(done){
var app = koa(); var app = koa();