diff --git a/app/extend/application.js b/app/extend/application.js index 74edfc15d4..7d6b673843 100644 --- a/app/extend/application.js +++ b/app/extend/application.js @@ -53,16 +53,6 @@ module.exports = { return context; }, - /** - * X-Powered-By Header - * @member {String} Application#poweredBy - * @private - * @since 1.0.0 - */ - get poweredBy() { - return this.config.core.name; - }, - /** * Service 基类 * @member {Service} Application#Service diff --git a/app/middleware/meta.js b/app/middleware/meta.js index 62f0956f67..a83a9de653 100644 --- a/app/middleware/meta.js +++ b/app/middleware/meta.js @@ -4,14 +4,9 @@ 'use strict'; -module.exports = (_, app) => { - const poweredBy = typeof app.poweredBy === 'string' ? app.poweredBy : null; - +module.exports = () => { return function* meta(next) { - if (poweredBy) this.setRawHeader('X-Powered-By', poweredBy); - yield next; - // total response time header this.setRawHeader('X-Readtime', Date.now() - this.starttime); }; diff --git a/config/config.default.js b/config/config.default.js index 6dca687261..9a089671cf 100644 --- a/config/config.default.js +++ b/config/config.default.js @@ -69,15 +69,6 @@ module.exports = appInfo => { rundir: path.join(appInfo.baseDir, 'run'), }; - /** - * Framework name - * @member {Object} Config#core - * @property {String} name - 'Egg' by default - */ - exports.core = { - name: 'Egg', - }; - /** * notfound 中间件 options * diff --git a/lib/egg.js b/lib/egg.js index b597ecf5a6..9b63fb4c9d 100644 --- a/lib/egg.js +++ b/lib/egg.js @@ -56,7 +56,6 @@ class EggApplication extends EggCore { * name: 'mockapp', * env: 'test', * subdomainOffset: 2, - * poweredBy: 'egg/1.0.0', * config: '', * controller: '', * service: '', @@ -90,7 +89,6 @@ class EggApplication extends EggCore { 'baseDir', 'env', 'subdomainOffset', - 'poweredBy', ]); abbr(res, this, [ diff --git a/test/lib/core/app/extend/application.test.js b/test/lib/core/app/extend/application.test.js index 59bc7781df..c984bdfeb1 100644 --- a/test/lib/core/app/extend/application.test.js +++ b/test/lib/core/app/extend/application.test.js @@ -24,7 +24,7 @@ describe('test/lib/core/app/extend/application.test.js', () => { app.ready(() => { app.inspect().should.have.properties([ 'name', 'baseDir', - 'env', 'subdomainOffset', 'poweredBy', + 'env', 'subdomainOffset', 'controller', 'middlewares', 'serviceClasses', 'config', 'urllib', 'loggers', ]); diff --git a/test/lib/core/app/middleware/meta.test.js b/test/lib/core/app/middleware/meta.test.js index b3e73aec6b..c92102b848 100644 --- a/test/lib/core/app/middleware/meta.test.js +++ b/test/lib/core/app/middleware/meta.test.js @@ -15,20 +15,6 @@ describe('test/lib/core/app/middleware/meta.test.js', () => { afterEach(mm.restore); - it('should get X-Powered-By header', () => { - return request(app.callback()) - .get('/') - .expect('X-Powered-By', 'Egg') - .expect(200); - }); - - it('should still get X-Powered-By header when controller error', () => { - return request(app.callback()) - .get('/error') - .expect('X-Powered-By', 'Egg') - .expect(500); - }); - it('should get X-Readtime header', () => { return request(app.callback()) .get('/') diff --git a/test/lib/core/config/config.test.js b/test/lib/core/config/config.test.js index 91eb27cd85..7c8910f5fa 100644 --- a/test/lib/core/config/config.test.js +++ b/test/lib/core/config/config.test.js @@ -13,7 +13,7 @@ describe('test/lib/core/config/config.test.js', () => { afterEach(mm.restore); - it('should return config.core.name that is deprecated', () => { - app.config.core.name.should.equal('Egg'); + it('should return config.name', () => { + app.config.name.should.equal('demo'); }); });