feat: [BREAKING_CHANGE] remove poweredBy && config.core (#63)

This commit is contained in:
TZ | 天猪 2016-08-29 19:15:42 +08:00 committed by Haoliang Gao
parent c356b04f4d
commit 7a17c0f1ae
7 changed files with 4 additions and 44 deletions

View File

@ -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

View File

@ -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);
};

View File

@ -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
*

View File

@ -56,7 +56,6 @@ class EggApplication extends EggCore {
* name: 'mockapp',
* env: 'test',
* subdomainOffset: 2,
* poweredBy: 'egg/1.0.0',
* config: '<egg config>',
* controller: '<egg controller>',
* service: '<egg service>',
@ -90,7 +89,6 @@ class EggApplication extends EggCore {
'baseDir',
'env',
'subdomainOffset',
'poweredBy',
]);
abbr(res, this, [

View File

@ -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',
]);

View File

@ -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('/')

View File

@ -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');
});
});