Skip to content

Commit

Permalink
fix: make options more compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Aug 19, 2019
1 parent 1015cea commit 287e589
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 comment has been minimized.

Copy link
@alvinhui

alvinhui Aug 19, 2019

Looks like only this line of code makes sense?

this.middleware = [];
this.context = Object.create(context);
this.request = Object.create(request);
this.response = Object.create(response);
Expand Down

3 comments on commit 287e589

@lyh873468428
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare 2.8.0 and 2.8.1 feels no difference

@alvinhui
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not understand why this PR works, looks like somewhere to determine whether the keys attribute exists?

@dead-horse
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check out this pull request eggjs/egg#3891

Please sign in to comment.