fix Application.inspect() – missing .proxy value. Closes #563

fix trailing comma
This commit is contained in:
TJ Holowaychuk 2015-10-29 09:51:11 -07:00
parent 6d3b81fe50
commit aa1fbbff4a
3 changed files with 15 additions and 3 deletions

View file

@ -38,9 +38,10 @@ module.exports = class Application extends Emitter {
constructor() { constructor() {
super(); super();
this.env = process.env.NODE_ENV || 'development'; this.proxy = false;
this.subdomainOffset = 2;
this.middleware = []; this.middleware = [];
this.subdomainOffset = 2;
this.env = process.env.NODE_ENV || 'development';
this.context = Object.create(context); this.context = Object.create(context);
this.request = Object.create(request); this.request = Object.create(request);
this.response = Object.create(response); this.response = Object.create(response);
@ -73,10 +74,18 @@ module.exports = class Application extends Emitter {
toJSON() { toJSON() {
return only(this, [ return only(this, [
'subdomainOffset', 'subdomainOffset',
'proxy',
'env' 'env'
]); ]);
} }
/**
* Inspect implementation.
*
* @return {Object}
* @api public
*/
inspect() { inspect() {
return this.toJSON(); return this.toJSON();
} }

View file

@ -1,12 +1,14 @@
'use strict'; 'use strict';
const assert = require('assert');
const Koa = require('../..'); const Koa = require('../..');
describe('app.inspect()', function(){ describe('app.inspect()', function(){
it('should work', function(){ it('should work', function(){
const app = new Koa(); const app = new Koa();
const util = require('util'); const util = require('util');
util.inspect(app); const str = util.inspect(app);
assert.equal("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
}); });
}); });

View file

@ -10,6 +10,7 @@ describe('app.toJSON()', function(){
obj.should.eql({ obj.should.eql({
subdomainOffset: 2, subdomainOffset: 2,
proxy: false,
env: 'test' env: 'test'
}); });
}); });