Skip to content

Commit

Permalink
fix inspection of app. Closes koajs#108
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Mar 11, 2014
1 parent 895cf40 commit 9b1651a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ module.exports = {
*/

inspect: function(){
if (!this.req) return;
return this.toJSON();
},

Expand Down
1 change: 1 addition & 0 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ module.exports = {
*/

inspect: function(){
if (!this.res) return;
var o = this.toJSON();
o.body = this.body;
return o;
Expand Down
8 changes: 8 additions & 0 deletions test/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9b1651a

Please sign in to comment.