From 287e589ac773d3738b2aa7d40e0b6d43dde5261b Mon Sep 17 00:00:00 2001 From: dead-horse Date: Mon, 19 Aug 2019 11:54:41 +0800 Subject: [PATCH] fix: make options more compatibility --- lib/application.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/application.js b/lib/application.js index a1f607f..098ecb1 100644 --- a/lib/application.js +++ b/lib/application.js @@ -44,13 +44,14 @@ module.exports = class Application extends Emitter { * */ - constructor(options = {}) { + constructor(options) { super(); + options = options || {}; this.proxy = options.proxy || false; - this.middleware = []; this.subdomainOffset = options.subdomainOffset || 2; this.env = options.env || process.env.NODE_ENV || 'development'; - this.keys = options.keys || undefined; + if (options.keys) this.keys = options.keys; + this.middleware = []; this.context = Object.create(context); this.request = Object.create(request); this.response = Object.create(response);