remove powered-by header
This commit is contained in:
parent
a54d3528a8
commit
8eb6cc0a7c
2 changed files with 16 additions and 0 deletions
|
@ -15,6 +15,7 @@ import { Options } from './types';
|
||||||
export default function createServer(opts : Options) : express.Application {
|
export default function createServer(opts : Options) : express.Application {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
app.disable('x-powered-by');
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
app.use(logging);
|
app.use(logging);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,21 @@ describe('Server', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should nave no x-powered-by header', function (done) {
|
||||||
|
runServer({
|
||||||
|
allowed_ips: [],
|
||||||
|
basicAuth: [],
|
||||||
|
dirList: false,
|
||||||
|
serveDir: 'site/',
|
||||||
|
opbeat: false,
|
||||||
|
open: false
|
||||||
|
}, '/index.html', function (response : any) {
|
||||||
|
expect(response.status).to.equal(200);
|
||||||
|
expect(response.headers.get('x-powered-by')).to.equal(null);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('index route', function () {
|
describe('index route', function () {
|
||||||
const body = fs.readFileSync(path.join(__dirname, '..', 'site', 'index.html')).toString();
|
const body = fs.readFileSync(path.join(__dirname, '..', 'site', 'index.html')).toString();
|
||||||
|
|
||||||
|
|
Reference in a new issue